Application fail to terminate between multiple forms

  • Thread starter Thread starter pedestrian via DotNetMonster.com
  • Start date Start date
P

pedestrian via DotNetMonster.com

I create 2 forms for a windows form application: (coding attached)
1) FrmLogin : the login form which show when the application start
2) FrmMain : the main form which show if user input "User" in a textbox in
login form, else
it won't show.

Problem: If I input "user" in login form to go to the main form, main form is
shown, but
when I close the main form (FrmMain), the application doesn't terminate...

How to manage application termination for multiple forms project which show
only 1 form
at a time? Thanks for replying...


Public Class FrmLogin

Private Sub btnOK_Click(...)...
If txtUser.Text = "User" Then
Me.Hide()
FrmMain.Show()
Else
Me.Close()
End If
End Sub

End Class
 
The application does not terminate because the login form is still running
... you've just hidden it.

One way to do this would be to raise an event from the main form when the
close button is clicked, handle it in the login form where you could call
Me.Close().
 
I shall try it... Thanks FUnky...
The application does not terminate because the login form is still running
.. you've just hidden it.

One way to do this would be to raise an event from the main form when the
close button is clicked, handle it in the login form where you could call
Me.Close().
 
Back
Top