|
-
Dec 14th, 2009, 07:19 AM
#1
Thread Starter
New Member
null reference exception was unhandled :|
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
This is the code this exception occurs when i click on the home button of my webbrowser.
Or i enter any site on the combobox.
-
Dec 14th, 2009, 12:26 PM
#2
Re: null reference exception was unhandled :|
This is not VBScript. Maybe VB.Net?
-
Dec 14th, 2009, 12:31 PM
#3
Re: null reference exception was unhandled :|
Do me and the rest of us a favor, please? Point out which line is the problem... you haven't given the buttons meaningfulnames, and I'm not going to even begin to try to figure out which of those buttons is your "home" button....
-tg
-
Dec 14th, 2009, 01:02 PM
#4
Re: null reference exception was unhandled :|
Based on Guuby's profile saying "Visual Basic 2008 express edition", I have moved this thread to our 'VB.Net' (VB2002 and later) forum.
-
Dec 15th, 2009, 02:31 AM
#5
Thread Starter
New Member
Re: null reference exception was unhandled :|
Ok first of all i am very sorry it is my first time here don't know exactly where to post i will try to give all the information demanded.
I will make some screens to the problem.
This exceptions always come if my browser navigates on a site or just press the button to go home...


Code:
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).GoHome()
This is the line that gives me the exception but this time it gives ArgumentOutOfRange Exception was unhandled...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|