Lanc1988 Posted August 26, 2005 Posted August 26, 2005 On my main form i want it do do something when one of my other forms closes, my main form is called frmMain and my other form is called frmLookup so is there a code that i can put on my main form to say something like when frmlookup closes do the following and it would do what i need it to do. Quote
*Experts* DiverDan Posted August 26, 2005 *Experts* Posted August 26, 2005 How is frmLookup created? If modally via ShowDialog then you could dimension a Public Shared variable called Response As DialogResult in frmLookup's declaration section. When frmLookup closes set Response to DialogResult.Ok. Then from frmMain use: Dim newLookup as New frmLookup newLookup.ShowDialog If newLookup.Response = DialogResult.Ok Then 'do your stuff here End If If you create frmLookup with .Show then you'll need to setup a delegate in frmLookup like ...in the declaration section of frmLookup: Event ClosingForm() When you close frmLookup call the delegate by raising the event: Private Sub frmLookup_Closing(by Val........) Handles MyBase.Close RaiseEvent ClosingForm() End Sub Then in frmMain finish the process with a sub to handle the delegate: Private Sub frmLookupClosed Handles frmLookup.ClosingForm() 'do your stuff here End Sub I hope that gives you a few options to start with. Quote Member, in good standing, of the elite fraternity of mentally challenged programmers. Dolphins Software
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.