Using Threading

  • Thread starter Daniel Romaniuk via .NET 247
  • Start date
D

Daniel Romaniuk via .NET 247

Hello,

Can you help me with this problem?
I've developed a Class (class A) that receives socket events, itis handled in a Thread that raise events to other class (ClassB) that has instanced this class. The class Class B cannot showa form in the event because the form locked. Why it occours? I'mshowing not modal form, it's look like I'm blocking the threadthat raise events..
 
A

AlexS

Hi, Daniel

You might need to check on which threads your events are executed. Easiest
way is to use Debug.Print or Console.WriteLine in event handlers, which
print thread id or names (if have them unique for every thread running). It
might happen you try to show form on non-UI thread. That's one thing.
Another is - how you show form, Form.Show or Form.ShowDialog?
ShowDialog might work Ok, Show will require message pump, which exists only
on UI thread.

HTH
Alex

Hello,

Can you help me with this problem?
I've developed a Class (class A) that receives socket events, it is handled
in a Thread that raise events to other class (Class B) that has instanced
this class. The class Class B cannot show a form in the event because the
form locked. Why it occours? I'm showing not modal form, it's look like I'm
blocking the thread that raise events..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top