help please with loading and unloading forms
I am currently working on a phone book project, the phone book has two forms , Frmlogin and frmPbook. I have finally been able to get the the frmlogin to work porperly however when clicking on proceed it opens the second form but for some reason I am not able to get frmlogin to close after frmPbook loads. Please help , Thank you.
the code for frmlogin is listed below.
Public Class FrmLogin
Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnOK.Click
' Make sure the user entered something.
If TxtUname.Text.Length = 0 Then
MsgBox("You must enter a user name", _
MsgBoxStyle.Exclamation)
TxtUname.Focus()
ElseIf TxtPword.Text.Length = 0 Then
MsgBox("You must enter a password", _
MsgBoxStyle.Exclamation)
TxtPword.Focus()
End If
If TxtUname.Text <> "Tom" And TxtPword.Text <> "mash4077" Then
MsgBox("Your UserName and Password are Incorrct", _
MsgBoxStyle.Exclamation)
TxtUname.Focus()
TxtPword.Focus()
End If
If TxtPword.Text = "mash4077" And TxtUname.Text = "Tom" Then
Btnfailpass.Text = "Click Here to Proceed" 'Continue
End If
If Btnfailpass.Text = "Click Here to Proceed" Then
Btnfailpass.Visible = True
End If
End Sub
Private Sub BtnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCancel.Click
End 'clicked cancel button
End Sub
Private Sub FrmLogin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TxtPword.PasswordChar = "*"
End Sub
Private Sub Btnfailpass_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnfailpass.Click
FrmPbook.ShowDialog()
End Sub
End Class
--------------------------------------------------------------------------------
|