Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I did search in this forum before post this question...

 

Pass reference to Form A to Form B... I think I understand that, it means if I never pass, then there is no way to unload the form A?

  • Leaders
Posted

give formB a property or function (or constructor parameter) that allows formA to send its reference to formB, ie:

 

Private Dim FormToClose as Form
.
.
.
Public Sub SetFormToClose(FormA as form)
   FormToClose = FormA
End Sub[/Code]

 
so that anytime formb can just call [code]FormToClose.Close

 

After FormA creates FormB, FormA should make the call

FormB.SetFormToClose(Me)[/Code]

to provide formB with a reference to itself

[sIGPIC]e[/sIGPIC]
  • *Experts*
Posted
Remeber that if you close the the form on which the application loop depends then the whole application closes. So if you start with FormA it might be a better idea to hide it.

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...