Getting cross thread error when executing tcViewer.TabPages.Add(t) statement.
Code is as below.
Private Function fff(t As TabPage)
tcViewer.TabPages.Add(t) 'giving cross thread error
End Function
Function WebBrowserThread()
Dim t As TabPage = New TabPage((k + 1).ToString())
t.Name = k.ToString()
tcViewer.Invoke(fff(t))
End Function
Please guide.
i don't know what invoking error you get but i suggest disabling cross-thread checking by adding this in the constructor or loaded event (very helpful when dealing with APIs)
Check this http://tech.xster.net/tips/invoke-ui-changes-across-threads-on-vb-net/
in wpf such problems are easy to fix because you have a single thread for all the controls (
Dispatcher.Invoke)Update
dealing with the UI controls have to be on the UI thread