Question cancel from input box

kieran82

Member
Joined
Feb 21, 2010
Messages
19
Programming Experience
Beginner
I have a drink program with 4 staff members and want to know how to cancel the input box if they accidently click on another persons login. can you close the input box by clicking can and to close the loop. All Logins have the same code just different names
VB.NET:
'Marys Login Button
    Private Sub btnMary_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMary.Click

        Dim counter As Integer = 0 ' Reserve Counter as integer in memory and assign a value to it
        Dim strUsername As String  'Username
        Dim intPassword As Integer   'Password

        'Do Until Loop to check to see if the Correct Username & Password Is Entered
        Do Until (strUsername) = "Mary" And intPassword = 1234

            ' This Is The Loop
            counter += 1 ' Counter Increments by 1
            'If the counter is greater than 5 popup message box and close program
            If counter > 5 Then
                ' Show Message Box Is Details Are Entered Incorrect More Than 3 Times!
                MsgBox("No More Attempts Left", MsgBoxStyle.Exclamation, )
                End 'Close Program
            End If

            'Username InputBox
            strUsername = InputBox("Enter Username!", "Login")
            'Password InputBox
            intPassword = UCase(InputBox("Enter Password!", "Login"))
        Loop

        ' If Login Is Sucessful, Show Manager Options
        Username = "Mary" 'Store Staff Name in Username in Public
        MessageBox.Show(UCase(Username) & " Has Logged In", "Login") 'Popup Message box

        End Sub
 
Back
Top