Create new form from alternate thread

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • xmutantduck

    #1

    Create new form from alternate thread

    Hi, I am trying to write a program that can spawn forms when running in
    an alternate thread outside the main one. It however doesnt like to do
    anything related to the first thread when in the second one. How can i
    create a secondary form from an alternate thread? Thanks.

  • Herfried K. Wagner [MVP]

    #2
    Re: Create new form from alternate thread

    "xmutantduc k" <xmutantduck@gm ail.com> schrieb:[color=blue]
    > Hi, I am trying to write a program that can spawn forms when running in
    > an alternate thread outside the main one. It however doesnt like to do
    > anything related to the first thread when in the second one. How can i
    > create a secondary form from an alternate thread?[/color]


    I am courious why you would want to create the forms on separate threads.
    Instead of running forms in separate threads I suggest to put the operations
    the forms are performing into separate threads and keep all of the forms
    running in the application's main thread.

    --
    M S Herfried K. Wagner
    M V P <URL:http://dotnet.mvps.org/>
    V B <URL:http://classicvb.org/petition/>

    Comment

    • Brian Gideon

      #3
      Re: Create new form from alternate thread

      If you want the alternate thread initiating the display of other forms
      then you need to use Control.Invoke to marshal a method onto the main
      UI thread where you can safely display other forms.

      Brian

      xmutantduck wrote:[color=blue]
      > Hi, I am trying to write a program that can spawn forms when running in
      > an alternate thread outside the main one. It however doesnt like to do
      > anything related to the first thread when in the second one. How can i
      > create a secondary form from an alternate thread? Thanks.[/color]

      Comment

      Working...