Thread obsoleto altro problema browser

alfred65

Utente Attivo
Autore del topic
25 Ottobre 2009
445
0
Miglior risposta
0
dopo aver risolto il precedente errore ora me ne da un altro questa volta in una stringa.il codice intero e questo
Public Class Form1


Private Property Int As Object




Private Sub SplitContainer1_Panel2_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs)

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
My.Settings.Reload()
Dim cnt As Integer = My.Settings.Preferiti.Count()
Dim x As Integer
For x = 0 To cnt - 1
ListBox1.Items.Add(My.Settings.Preferiti.Item(x))
Next
Me.SplitContainer1.Panel1Collapsed = True
Me.SplitContainer1.Panel2Collapsed = False
End Sub

Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
WebBrowser1.Navigate(ListBox1.Text)
End Sub

Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs)

End Sub

Private Sub Preferiti_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button.Click
Me.SplitContainer1.Panel1Collapsed = False
Me.SplitContainer1.Panel2Collapsed = False
Me.ListBox1.Visible = True
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
My.Settings.Preferiti.Add(WebBrowser1.Url.AbsoluteUri)
ListBox1.Items.Add(WebBrowser1.Url.AbsoluteUri)
My.Settings.Save()
Catch ex As Exception
End Try
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
WebBrowser1.GoBack()
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
WebBrowser1.GoForward()
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
WebBrowser1.Refresh()
End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
WebBrowser1.Stop()
End Sub

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
WebBrowser1.GoHome()
End Sub

Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
WebBrowser1.Navigate(TextBox1.Text)
End Sub

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged



End Sub



Private Sub WebBrowser1_DocumentCompleted_1(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs)

End Sub

Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
WebBrowser1.Navigate("http://codelyokoitalia.forumcommunity.net/?t=44213413")
End Sub

Private Sub AggiungiPaginaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AggiungiPaginaToolStripMenuItem.Click
Dim Browser As New WebBrowser
pagina.TabPages.Add("New Page")
pagina.SelectTab(0)
Browser.Name = "Web Browser"
Browser.Dock = DockStyle.Fill
pagina.SelectedTab.Controls.Add(Browser)
AddHandler Browser.DocumentCompleted, AddressOf Done
Int = Int() + 1
CType(pagina.SelectedTab.Controls.Item(0), WebBrowser).GoHome()
CType(pagina.SelectedTab.Controls.Item(0), WebBrowser).ScriptErrorsSuppressed = True
End Sub


Private Sub RimuoviSchedeToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RimuoviSchedeToolStripMenuItem.Click
pagina.TabPages.Clear()
Int = 0
End Sub

Private Sub AnteprimaDiStampaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AnteprimaDiStampaToolStripMenuItem.Click
WebBrowser1.ShowPrintPreviewDialog()
End Sub

Private Sub StampaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StampaToolStripMenuItem.Click
WebBrowser1.ShowPrintDialog()
End Sub




Private Sub ImpostaPaginaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ImpostaPaginaToolStripMenuItem.Click
WebBrowser1.ShowPageSetupDialog()
End Sub

Private Sub SalvaPaginaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SalvaPaginaToolStripMenuItem.Click
CType(pagina.SelectedTab.Controls.Item(0), WebBrowser).ShowSaveAsDialog()
End Sub




Private Sub InformazioniToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles InformazioniToolStripMenuItem.Click
MsgBox("Mevin v 1.0 created by Alfredo mangano ", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Istruzioni")
End Sub

Private Sub TagliaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TagliaToolStripMenuItem.Click
TextBox1.Cut()
End Sub

Private Sub IncollaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles IncollaToolStripMenuItem.Click
TextBox1.Paste()
End Sub

Private Sub CopiaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopiaToolStripMenuItem.Click
TextBox1.Copy()
End Sub

Private Sub FileToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FileToolStripMenuItem.Click

End Sub

Private Sub TabPage1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

End Sub

Private Sub TabPage2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

End Sub

Private Sub Done(ByVal sender As Object, ByVal e As WebBrowserDocumentCompletedEventArgs)




End Sub






End Class
'Declaration

<SerializableAttribute> _
<ComVisibleAttribute(True)> _
Public Class AccessViolationException = (Inherits SystemException)
End Class



E la stringa dove mi da errorre e questa:
CType(pagina.SelectedTab.Controls.Item(0), WebBrowser).GoHome()

E l errore e questo (sempre dall solito rettangolino)
InvalidCastException non e stata gestita
Impossibile eseguire il cast di oggetti di tipo 'System.Windows.Forms.SplitContainer' sul tipo 'System.Windows.Forms.WebBrowser'.
Suggerimenti per la risoluzione dei problemi
quando si esegue il cast da un numero,il valore deve essere un numero inferiore a infinito
assicurarsi che il tipo di origine sia convertibile nel tipo di destinazione
visualizza la guida generale per questa eccezione
cerca ulteriori informazioni nella guida
Azioni
visualizza dettagli
copia dettaglio eccezione negli appunti

I dettagli sono
System.InvalidCastException non è stata gestita
Message=Impossibile eseguire il cast di oggetti di tipo 'System.Windows.Forms.SplitContainer' sul tipo 'System.Windows.Forms.WebBrowser'.
Source=Mevin browser
StackTrace:
in Mevin_browser.Form1.AggiungiPaginaToolStripMenuItem_Click(Object sender, EventArgs e) in C:\Documents and Settings\User\Documenti\Visual Studio 2010\Projects\Mevin beta\Mevin beta\Form1.vb:riga 97
in System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
in System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
in System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
in System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
in System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
in System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
in System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
in System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
in System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
in System.Windows.Forms.Control.WndProc(Message& m)
in System.Windows.Forms.ScrollableControl.WndProc(Message& m)
in System.Windows.Forms.ToolStrip.WndProc(Message& m)
in System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
in System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
in System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
in System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
in System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
in System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
in System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
in System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
in Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
in Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
in Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
in Mevin_browser.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:riga 81
in System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
in System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
in Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
in System.Threading.ThreadHelper.ThreadStart_Context(Object state)
in System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
in System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
in System.Threading.ThreadHelper.ThreadStart()
InnerException:

SE QUALCUNO MI PUO AIUTARE GLIENE SAREI GRATO
--------------- AGGIUNTA AL POST ---------------
Propio nessuno mi puo aiutare?? :emoji_slight_frown:
 
Ultima modifica: