New form on a different thread

Posted by Dan on Stack Overflow See other posts from Stack Overflow or by Dan
Published on 2011-01-12T05:10:20Z Indexed on 2011/01/12 5:53 UTC
Read the original article Hit count: 162

Filed under:
|
|
|

So I have a thread in my application, which purpose is to listen to messages from the server and act according to what it recieves.

I ran into a problem when I wanted to fire off a message from the server, that when the client app recieves it, the client app would open up a new form. However this new form just freezes instantly.

I think what's happening is that the new form is loaded up on the same thread as the thread listening to the server, which of course is busy listening on the stream, in turn blocking the thread.

Normally, for my other functions in the clients listening thread, I'd use invokes to update the UI of the main form, so I guess what I'm asking for is if here's a way to invoke a new form on the main form.

© Stack Overflow or respective owner

Related posts about c#

Related posts about winforms