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!

Load form at startup if condition is met

Status
Not open for further replies.
May 22, 2003
42
US
Hi



I have a form with a checkbox control. How would you load this form at starup if the checkbox is checked? Do you load it from the main form?



Tony
 
To me that depends on two things...Your experience with VB code and your requirements.

VB experience is simple enough. Hopefully you know how to declare, instantiate and show a form.

Requirements are another matter. You probably have a mainform that opens when the application is started. Using the OnLoad event of that form, you could check to determine if the box is checked (more than likely having to pull from a table or config file) and display your second form if checked.

A bit more advanced is to use an application event, thereby allowing you to evaluate and open this form even before your mainform is loaded. This involves a bit more experience to implement, but is not much more difficult in my opinion.

You have to ask yourself what is the objective here. If you just want a second form to open when the main opens, then the first scenario works great. If you want a "info" type form to open (similar to the first screen of many wizards where you check the box to show/not show at startup), then the second scenario fits that mold.

Think about it, make your decision, give it a shot and then return here if you get stuck or need some more info.

=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
VB/Access Programmer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top