show a form from a thread

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • deviranir
    New Member
    • Dec 2008
    • 6

    show a form from a thread

    Hi,

    I am developing a desktop chat application using vb.net.
    My design is as follows :

    1. Have a login form
    2. Have a contacts form
    3. Have a chat form

    The chat form should be opened at runtime depending upon my chat server response. I should always listen for the response from the server and open the form.
    I written a function which will listen for the response and trying a open the chat form. I am calling this function in a thread. I always get the error that i cannot open a form from the thread. I get the folloeing error.

    ActiveX control '<GUID>' cannot be instantiated because the current thread is not in a single-threaded apartment.

    How can i solve this.

    Your help is very much required.

    Thanks,
    Dev.
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    I think I know what's happening: it's how you are calling the function in the thread. You need to reorganize your application so that it uses a Single-Thread Apartment for your Chat window.

    What language are you using to implement your solution?

    -Frinny

    Comment

    Working...