Application fail to terminate between multiple forms

  • Thread starter pedestrian via DotNetMonster.com
  • 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
 
F

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().
 
P

pedestrian via DotNetMonster.com

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().
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top