How to close the login form after successful login to show the Main form?


I am working in vb.net. I have a login form and after successfull login I want to close the login form and show the Mdi Main form. But my application exits after the line frmMain.show. How should i make the application running after closing the login form.

Thanks in advance.
vinodjnairAsked:
Who is Participating?
 
PhoenixricCommented:
Hi,
Can we see the code after the success in log-in?

First thing is that your log-in form should be your star-up form.
Secondly, your form should be an independent form and the MDI child is not set to true.

And presumably after the success in log-in you have a code something like this :

if  LogInSuccess = true
    Unload me -> which unload the log-in form itself
   frmMain.show
else
   Msgbox "Access Denied"
End If

Get back to me if stil doesnt work. Good luck
0
 
leflonCommented:
Hi vinodjnair,

is the login form your startup form?
and how do you close the login form?
you may better make frmMain your startup form and open login form as the first action.

leflon
0
 
venishjoeCommented:
Hai,

   You can try with the hide function and not closing

i.e.,  frmLogin.Hide
and then frmMain.show

Hope this helps

Regards
Venish
0
 
ckiralyCommented:
hey vinodjinar -

the best way to go is to have your login form seperate from your main form.

have your main form open your login form - in modal mode is best -

then they do the login, or cancel

then you can continue on with a proper login, or close the program if they cancel the log in.

If the continue with proper login, you then just close the login form, and show your main form, then continue on with your process...

Hope this helps...

CK
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.