I am hoping someone can help me with an issue I have:
I have a main form with an ObjectListView control on it. When I add objects to the control via code on the Main form, everything works fine, however....
I have a Class that does some processing. This class kicks off a ThreadPool to process incoming information, and once complete, I am trying to update the ObjectListView stored on the Main Form.
The weird thing is I get absolutely no errors and the debugger steps through fine, it's just that nothing ever gets populated on the control via that Class.
I don't know what I'm doing wrong...
So this gives me nothing:
Dim _activityItem As New ActivityItem
frmMain.lsvActivity.AddObject(_activityItem)
Yet it works fine on frmMain
Update I've turned off the ThreadPooling and it still doesn't update the ObjectListView control.
Update 2 Just to try and make things a little clearer, I'll explain how may app works (briefly):
Thanks
Try this.
frmMain.Invoke(Sub() frmMain.lsvActivity.AddObject(_activityItem))
You shouldn't access the UI controls directly from any threads other than the UI thread.
Control.Invoke
executes the specified delegate on the UI thread.