Show main form after login form
I need help in the following situation. Here's what I am trying to do. In the Computer Property Startup page, I set the frmLogin as the start up object. Then in this frmLogin form, the user will have to type in his/her user name and password. If it is valid, then dispose the frmLogin form and then load the frmMain form to the user. If the authentication failed then show the frmLogin again. Here's the pseudocode I have.
If the authentication failed then
close the connection and prompt the error messagebox
If the authentication succeed then
Dim MainForm As New frmMain
MainForm.Show()
frmLogin.Dispose()
End If
But this doesn't work. I see the frmMain popup very quick then the whole program ended. What's my problem here?
Any help is appreciated!
ljCharlie