Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

  • *Experts*
Posted

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.

Member, in good standing, of the elite fraternity of mentally challenged programmers.

 

Dolphins Software

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...