0

Hello,

I'm having a Form.Show() hang up on me. I currently have one class that has a listen() method that runs in its own thread. Then I Have another class that is my actual Windows Form with all the GUI stuff. The listen() method calls methods of my Windows Form. One of those methods initializes another Windows Form inside the Windows Form and shows it, and my program hangs up when it tries to show it. I'm almost positive it's a threading issue, and I'm not sure what to do. Any suggestions? Thanks!

3
Contributors
2
Replies
3
Views
10 Years
Discussion Span
Last Post by lok_tan
0

I'm almost positive it's a threading issue, and I'm not sure what to do. Any suggestions?

Me too. Try changing the code to make it work.

0

Actually I'm not sure with kind of coding that you do (maybe a code snippet will help), but from what I'm understanding from reading your post, that you try to invoke GUI-related function from non-GUI thread. Is that true?

If so, it's happened to be like that. That a .NET code will crash if you tried to invoke GUI-related things from another thread. All the GUI-related things must be invoked using it's own GUI/form thread.

Try to invoke it using Control's Invoke or BeginInvoke.

Regards,

Lok

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.