Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# Windows Forms Application - Updating GUI from another thread AND class?

Tags:

I've searched a ton, but I can't seem find anything relating to my specific problem.

I want to be able to update my MainUI form from another class (SocketListener) and within that I have a thread that handles the networking (clientThread). Right now I can run simple outputs from the networking thread such as writing to the debugger output and creating a MessageBox.

But what I really want to do is be able to invoke code from the clientThread that will do things on my MainUI instance. How can I do this?

Also, if anyone wants specific portions of the code then I can post it to help give you a better understanding of what I'm asking.

Best regards!