haroldjclements Posted February 16, 2005 Posted February 16, 2005 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 Quote
Administrators PlausiblyDamp Posted February 16, 2005 Administrators Posted February 16, 2005 Could you not just display the form as a modal form with the .ShowDialog method? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
haroldjclements Posted February 16, 2005 Author Posted February 16, 2005 .ShowDialog Method Thanks for your replay PlausiblyDamp Sorry for asking but how does the .ShowDialog method work? Thanks again, Harold Clements Quote
stustarz Posted February 16, 2005 Posted February 16, 2005 Just display your new form as a dialog form: 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! Quote Visit: VBSourceSeek - The VB.NET sourcecode library "A mere friend will agree with you, but a real friend will argue."
stustarz Posted February 16, 2005 Posted February 16, 2005 Oh! plausibly beat me too it! :) - sorry i wrote my reply and got distracted before i posted :D Quote Visit: VBSourceSeek - The VB.NET sourcecode library "A mere friend will agree with you, but a real friend will argue."
haroldjclements Posted February 16, 2005 Author Posted February 16, 2005 That is brilliant, thanking you both so kindly. Harold Clements Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.