Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Closing an application with multiple forms...

Status
Not open for further replies.

lbrechler

Programmer
May 17, 2001
44
US
Couple of questions, actually:

Question 1: I have an application with multiple forms. Right now, if you click the 'X' button in the upper right-hand corner of the first form that displays, the application closes. However, if I Show another form and then click the 'X' button, all the forms close, but the application returns to the Visual Basic window still Running (i.e. I have to click the "End" square to continue working). Is there a way to specify that when the 'X' button is clicked that the Running/Debugging should End as well?

Question 2: I'm primarily using .Show and .Hide to switch between the forms. What I'm seeing is that when I enter a value on the first form, all the database calls on all the other forms execute too (for instance, I'm seeing message boxes from other forms). While it's fine to leave forms open once they've been loaded, it's really degrading my performance to load them all up front. Is there a way to specify when to load the forms originally?

Thanks,
Lindsay
 
Forms do not load until referenced with a Load or Show.
To shutdown all forms.
Code:
Dim f as Form
For Each f in Forms
    unload f    
Next
Set f = nothing
' Do not reference any controls after this or you
' will cause the form to reload. Reference to form level
' variables will cause an error. Local variables Ok.
'****
' In every form
form_Unload()
    Set nameofform = nothing ' nameofform e.g. frmMain
End sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top