Threads and Forms

haroldjclements

Freshman
Joined
Jun 13, 2004
Messages
46
Hello,

I have a thread question that has been bugging me for some time.

If you are in the middle of an event (button1_click) and you call another form to be initialised. How can you pause the button1 event, work with the new form, when finished with the new form, hide it and carry on with the rest of the button_1 event?

What I am trying to do is have a form that collects items from a database. If the item number is not known then a search button can be pressed (button1) and a search form (new form) be displayed where the used can search for the item within the database. When they have found the item that they are looking for they close the search form and button1 uses a ‘get’ method to retrieve the value that you user found in the previous form.

Now I can get it to work except that it looks for the get method instantly. I want it to look for the ‘get’ method after the search form has been close.

Is there a way of pausing this thread until the search form is closed?

This in advance,
Harold Clements
 
.ShowDialog Method

Thanks for your replay PlausiblyDamp

Sorry for asking but how does the .ShowDialog method work?

Thanks again,
Harold Clements
 
Just display your new form as a dialog form:

Visual Basic:
Dim frm As New Form2
frm.ShowDialog()

Because the form is a dialog form it will pause the thread on the calling form, then when you close the new form the thread will resume. It's the same as calling a message box!
 
Back
Top