C#-Form: Difficulties with threading and new forms

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • foahchon
    New Member
    • Aug 2006
    • 13

    C#-Form: Difficulties with threading and new forms

    Hi, I'm trying to write an IRC client (yeah, another one), and I've written a component that creates a thread that polls a socket for new information, parses new lines, and calls associated events (for example, an OnJoin delegate is called when a room is joined).

    My problem is, I want a new form to be created when a room is joined, but every method I've tried for doing so creates either a modal form (not the desired type), or a form that freezes after it opens. So I guess my question is, what's the best way to open a responsive form from another thread? Is it possible? Is there a better approach? Any input would be appreciated.

    I have tried researching other C# IRC components/clients, but they all work as I have described above. Most clients seem to have been written before updating the GUI from a separate thread became "illegal," and so no Invoke/BeginInvoke commands are illegal.

    Thanks in advance for any help.
  • kenobewan
    Recognized Expert Specialist
    • Dec 2006
    • 4871

    #2
    Here is an article that may help you:
    ASP.NET 2.0 Provider Model: Introduction to the Provider Model

    Comment

    • Plater
      Recognized Expert Expert
      • Apr 2007
      • 7872

      #3
      Well there is something about GUI components on other threads that never seem to work so well. I think its because the windows messages never get to it.

      If you want to trigger a new form to open, I think getting the GUI thread to do it would be best. Whatever form is open is probably already in the GUI thread, so have IT'S thread open the new form, possible use the InvokeRequired proeprty to make sure it happens on the gui thread

      Comment

      Working...