Startup form cannot close

desmondtan

Freshman
Joined
Dec 24, 2002
Messages
40
My start up form asked the user the correct password , if password is correct , the main form displayed and close the star up form.

Dim main as new mainform
if passowrd = txtpassword.text then
main.showdialog()
me.close()
else
(retry ....)


The main form can be displayed , but the starup form still would not be closed , but at the back of main form.

Anyone knows ?
 
I'd rather use the mainForm as the startup form.

In the main forms load method, I'd show the password form and pass the validity check back to the main form. Then you can dispose the password form.
 
The problems is when main form loaded first , we must disabled the toolbar and main menu before the user can successfully login.

Do you have idea how to disabled these two control , and how to enabled it back after the user login ?
 
public sub mainForm_Load(byval sender as object, e as eventargs)
dim myForm as New PasswordForm
myForm.ShowDialog
end sub

This will load your password form as a Dialog, meaning that the user may not do anything on the main form until you let them basically.
(make the controlbox property false to ensure they don't just close it and use the form anyway)
 
I posted an example on how to solve this problem, you can close any form and keep your application running, attached you'll find it (I think is the correct example, if not, let me know)

regards
 
Back
Top