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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Differences Events Open Load <--> Close Unload

Status
Not open for further replies.

Crookshanks

Technical User
May 18, 2004
296
NL
Goodmorning,

When my app starts its opens the logonscreen. With the open event a set of variables are loaded. After entering the logonname and password the form is made invisible.

Q: is de form closed? when I make the form visible again, is it opened? It seems to be still open as the variables are not loaded again?
Q: Do I need to close the Form, before I can use the Open event again to trigger the load of variables?
Q: What are the differences between open/load en close/unload events of a form. How can you use them...

Anybody who can kick me in the right direction? Any help appreciated. Thanks in advance.

Kind regards,

 
1) no it's not closed unless you close it
2) OnOpen event will only launch when you OPEN the form
3) Not sure if you are asking the diff between (OnLoad vs. OnOpen) and (OnClose vs. OnUnload)? Or (OnOpen vs. OnClose)? In any case, they just all fire at different times. I use OnOpen much like you do. I've used OnClose to validate user's data, or to clean out temporary tables, for just two examples. There is also On Activate.

Per HELP:
Code:
When you open a form, the following sequence of events occurs for the form:

Open ? Load ? Resize ? Activate ? Current

If there are no active controls on the form, the GotFocus event also occurs for the form after the Activate event but before the Current event.

When you close a form, the following sequence of events occurs for the form:

Unload ? Deactivate ? Close

If there are no active controls on the form, the LostFocus event also occurs for the form after the Unload event but before the Deactivate event.

Maybe you want to keep things like you have them (invisible, visible), but be able to fire the code you have. Try putting it in OnActivate (can't guarentee this will work, it's just a suggestion to try out). To test first to see if OnActivate fires when you make the form visible, just put a little MSGBOX "On Activate" in the OnActivate event. If it fires when the form is made visible, move your OnOpen code to there. You can try the same with other events.

Hope this helps.

g
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top