Hey guys, im getting this "AweInvalidOperationException was unhandled, The calling thread cannot access this object because a different thread owns it." error after closing my application.
I think this is the piece of code that is causing this problem (i've commented it out and tried it without getting the error):
Thanks in advance!!!
I think this is the piece of code that is causing this problem (i've commented it out and tried it without getting the error):
Code:
Private Sub Main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim page As New vTabPage
Dim newtab As New Browser
newtab.Show()
newtab.TopLevel = False
newtab.Dock = DockStyle.Fill
page.Controls.Add(newtab)
page.Padding = New Padding(70, page.Padding.Top, 70, page.Padding.Bottom)
If Me.VTabControl1.TabPages.Count > 1 Then
VTabControl1.TabPages.Add(page)
Me.VTabControl1.TabPages.Insert(Me.VTabControl1.TabPages.Count - 1, page)
Else
Me.VTabControl1.TabPages.Insert(0, page)
End If
If Me.VTabControl1.TabPages.Count > 0 Then
Me.VTabControl1.SelectedTab = page
End If
If Not Me.tabToClose Is Nothing Then
If Me.VTabControl1.Tag Is Nothing Then
Me.VTabControl1.DeleteTabPage(Me.tabToClose)
If Me.VTabControl1.TabPages.Count > 0 Then
Me.VTabControl1.SelectedTab = Me.VTabControl1.TabPages(0)
End If
End If
End If
Me.VTabControl1.Invalidate()
End Sub