In a windows forms app, It is my understanding that I can easily invoke on the forms underlying thread like this:
How do I do the same thing on a console app, so that I invoke on the console app's main thread?
VB.NET:
Private Delegate Sub DelegateHandlerName(ByVal foo As Object)
Sub Main()
Dim T As New Thread(AddressOf InvokeDelegate)
T.IsBackground = True
T.Start()
End Sub
Sub InvokeDelegate
Dim dlg As New DelegateHandler(AddressOf DelegateHandlerName)
Dim args() As Object = {my_object}
Me.Invoke(dlg, args)
End Sub
Private Sub HandlerName(ByVal foo as Object)
' Do something on the main thread (not the T thread)
End Sub