This is the code this exception occurs when i click on the home button of my webbrowser.Code:Public Class Form1 Dim int As Integer = 0 Dim CustomerTable As New DataTable Dim instance As New InvalidOperationException() Class TestClass Public field1 As Integer Dim field2 As Boolean End Class Private Sub Loading(ByVal sender As Object, ByVal e As Windows.Forms.WebBrowserProgressChangedEventArgs) ToolStripProgressBar1.Maximum = e.MaximumProgress ToolStripProgressBar1.Value = e.CurrentProgress End Sub Private Sub Done(ByVal sender As Object, ByVal e As Windows.Forms.WebBrowserDocumentCompletedEventArgs) TabControl1.SelectedTab.Text = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).DocumentTitle ToolStripComboBox1.Text = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Url.ToString End Sub Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).GoBack() End Sub Private Sub ToolStripButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton2.Click CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).GoForward() End Sub Private Sub ToolStripButton3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton3.Click CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Refresh() End Sub Private Sub ToolStripButton4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton4.Click CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).GoHome() End Sub Private Sub ToolStripButton5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton5.Click CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate(ToolStripComboBox1.Text) End Sub Private Sub ToolStripButton6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton6.Click CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).GoSearch() End Sub Private Sub PageProprietysToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PageProprietysToolStripMenuItem.Click CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).ShowPropertiesDialog() End Sub Private Sub ToolStripButton10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton10.Click Dim Browser As New WebBrowser TabControl1.TabPages.Add("New Page") TabControl1.SelectTab(int) Browser.Name = "FireWolf" Browser.Dock = DockStyle.Fill TabControl1.SelectedTab.Controls.Add(Browser) AddHandler Browser.ProgressChanged, AddressOf Loading AddHandler Browser.DocumentCompleted, AddressOf Done int = int + 1 End Sub Private Sub PasteToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PasteToolStripButton.Click If Not TabControl1.TabPages.Count = 1 Then End If TabControl1.TabPages.RemoveAt(TabControl1.SelectedIndex) TabControl1.SelectTab(TabControl1.TabPages.Count - 1) int = int - 1 End Sub Private Sub ToolStripButton9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton9.Click CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate("www.youtube.com") End Sub Private Sub ToolStripButton8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton8.Click CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate("www.yahoo.com") End Sub Private Sub ToolStripButton7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton7.Click CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate("www.google.com") End Sub Private Sub ToolStripComboBox1_keydown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles ToolStripComboBox1.KeyDown If e.KeyCode = Keys.Enter Then ToolStripComboBox1.Items.Add(ToolStripComboBox1.Text) CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate(ToolStripComboBox1.Text) Me.Text = (ToolStripComboBox1.Text) End If End Sub Private Sub ToolstripCombobox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripComboBox1.SelectedIndexChanged CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate(ToolStripComboBox1.Text) End Sub End Class
Or i enter any site on the combobox.




Reply With Quote