Hi
I can't figure out why this is happening. The app throws a nullreferenceexception on Me.Controls.Add(tab(count)).
tab() is the name of the array of the usercontrols which has just a label and 2 pictureboxes in it.
I know what the error means just not sure why it's doing this. Any tips?
Thanks
I can't figure out why this is happening. The app throws a nullreferenceexception on Me.Controls.Add(tab(count)).
Code:
Public tab As Tab()
Public wb As WebBrowser()
Public count As Integer = 0
Public Sub NewTab(ByVal url As String)
Try
wb(count) = New WebBrowser
tab(count) = New Tab
wb(count).Name = "wb" & count.ToString()
wb(count).Location = New Point(0, 69)
wb(count).Size = New Size(903, 517)
wb(count).Navigate(url)
tab(count).Name = "tab" & count.ToString()
If (count > 1) Then tab(count).Size = tab(count - 1).Size
If (count = 0) Then tab(count).Size = New Size(212, 32)
If (count > 1) Then tab(count).Location = New Point(tab(count - 1).Location.X + 212, tab(count - 1).Location.Y)
If (count = 0) Then tab(count).Location = New Point(120, 0)
Me.Controls.Add(wb(count))
Me.Controls.Add(tab(count))
count = count + 1
Catch ex As Exception
MessageBox.Show(ex.Message())
End Try
End Sub
tab() is the name of the array of the usercontrols which has just a label and 2 pictureboxes in it.
I know what the error means just not sure why it's doing this. Any tips?
Thanks