In my visual Basic programming class we were given an assignment to create an application that checks the password at sign-on time (when the application starts). The application will display an input box requesting a password. If the password is correct, it will display the form (me.show) If if the password is incorrect a message box will display "Re-enter Password", if the password is incorrect 3 times a message will display " contact your administrator" then will exit the application. Now my question is When the password is correct It has to display the form. I have everything else working just not the form display. Here is my code.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim n As Integer
Dim strpassword As String = "begin"
n = 0
'3 chances to get the password right
Do Until n = 3
strpassword = InputBox("Please enter your password", )
'IF the password is correct it will display vb
If strpassword = "begin" Then
MessageBox.Show("Re-Enter Password", "Incorrect Password", MessageBoxButtons.OK)
n = n + 1
'If n = 3 the program will close
If n = 3 Then
MessageBox.Show("Invalid Password...Contact your Administrator", "Incorrect Password", MessageBoxButtons.OK, MessageBoxIcon.Stop)
So i was wondering if anyone here could point me in the direction of what im doing wrong.. feel free to edit the code.