the program is for a ficticious video rental store. you start off with a login screen and type in a user name and password. the program checks it against a list of those and sends the user to either a customer or an employee screen.
If strUser.ToLower = “cust” Then
ClearForm()
Me.Hide()
frmCustomer.Show()
ElseIf strUser.ToLower = “emp” Then
ClearForm()
Me.Hide()
frmEmpl.Show()
Else
MessageBox.Show(“Wrong Username or Password. Please try again.”, “Error.”, MessageBoxButtons.OK, MessageBoxIcon.Warning)
ClearForm() ‘ runs the ClearForm sub
End If
I’ve stepped through the code and the program seems to just ignore the Me.Close(). I was having a problem before I fiddled with it when the form would hide, but when it was shown after closing the emp/cust form, the program wouldn’t end and would stay resident in memory.
here’s code from the customer form (the user has to input a password before they can exit it, so ignore that junk):
Private Sub frmCustomer_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
Dim strInput As String = “”
Dim strPassword As String
Dim frmLogin As New frmLogin()
strPassword = InputBox(“Password:”, “Exit Password”, strInput)
If strPassword.ToLower = “exitout” Then
frmLogin.Show()
Else
MessageBox.Show(“Wrong Password.”, “Error”, MessageBoxButtons.OK, MessageBoxIcon.Error)
e.Cancel = True
End If
End Sub
what am I missing? why isn’t the computer doing what I think I’m telling it to do!? any help is appreciated!