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

Bringing a form to the top

Status
Not open for further replies.

rickgalty

Programmer
Nov 10, 2005
32
US
Good morning. When my applications main page opens, there is only one line in the "Form_Load" sub - it reads "frmLogin.Show". It is supposed to open the mini form that alows the user to enter his username and password. The problem is that frmLogin opens BEHIND frmMain, and I can't figure out why. Can anyone help me please?

Richard
 
Try....

frmLogin.Show vbModal

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Lightning fast, and correct, what more could one want?
Thanks a lot, Richard
 
<what more could one want?

Well, perhaps a surfeit of selections, a plethora of possibilities, a confusion of choices....

Another way to do this:

Make your login form the startup form. Then, if the proper login sequence is given, show the main form. (Otherwise end, without ever showing the main form.) In the main form's Load event, unload the Login form.

I like to do this because I get a sense of security out of never even beginning to load the main form until the user is cleared. George's way is entirely correct as well, of course.

:)

Bob
 
I also do things the way Bob suggests. My login form is set to startup. Only if you successfully log in, do you see the main form.

To make the login form be the statup object...

Click Project -> Properties.

On the general tab, set the startup object to your login form.

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Thanks guys. Yes, if I'd planned on a login from the git-go I'd have gone that way, but the app currently runs with no log-in, and security's been requested as a new feature.

Richard
 
Well, it's easy enough to change it if you should want to.
1. Add the login form
2. Make it the startup form
3. On your Ok button, after you validate user input, show the main form and unload me.

Or, if you want to preserve the user name in a variable, set it up as a property of the login form. In the main form's load event, assign the property's value to a variable, and then unload the login form.

Bob
 
frmLogin.show
frmLogin.zorder 0

This will place the form in front of the other.

Shannan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top