|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Thread terminating instantlyHi all,
I'm launching a form in a new thread as follows below. The problem is the form exits straight away. How do I cause it to stay open until the form is closed? The suspend won't work since I need to get UI events from the form controls. Dim MyThread As System.Threading.Thread MyThread = New System.Threading.Thread(AddressOf LaunchAccountsForm) Call MyThread.Start() Thanks, Adam Adam Honek wrote:
Show quoteHide quote > Hi all, You should launch a UI element in a new thread.> > I'm launching a form in a new thread as follows below. The problem is the > form exits straight away. > > How do I cause it to stay open until the form is closed? > > The suspend won't work since I need to get UI events from the form controls. > > Dim MyThread As System.Threading.Thread > > MyThread = New System.Threading.Thread(AddressOf LaunchAccountsForm) > > Call MyThread.Start() > > Thanks, > Adam > > But since you didn't show the code that you used to open the form we can only guess. I'd guess you are using .Show instead of .Showdialog. But like I said, you should look at how you are doing this because all your UI elements should stay in the same thread. Chris Thanks a lot, yes showdialog did it.
It's just a config form that doesn't need to interact with the main form hence I'm not worried about joining the threads together. Adam Show quoteHide quote "Chris" <no@spam.com> wrote in message news:OU6n$ELcGHA.3352@TK2MSFTNGP03.phx.gbl... > Adam Honek wrote: >> Hi all, >> >> I'm launching a form in a new thread as follows below. The problem is the >> form exits straight away. >> >> How do I cause it to stay open until the form is closed? >> >> The suspend won't work since I need to get UI events from the form >> controls. >> >> Dim MyThread As System.Threading.Thread >> >> MyThread = New System.Threading.Thread(AddressOf LaunchAccountsForm) >> >> Call MyThread.Start() >> >> Thanks, >> Adam > > You should launch a UI element in a new thread. > > But since you didn't show the code that you used to open the form we can > only guess. I'd guess you are using .Show instead of .Showdialog. But > like I said, you should look at how you are doing this because all your UI > elements should stay in the same thread. > > Chris
Read Emails on Exchange server without OL client
VB2005 timing/speed problem single to string problem Error setting CSV to display text set focus from treeview to control Invalid format of DLL How to move the mouse around in vb.net Move emails (.msg files) between an Outlook inbox and a file direc How to simulate mouse click in vb.net How do I take a screenshot in VB.net 2005 |
|||||||||||||||||||||||