Guy's i have this problem in my codes, it should be showing the form i choose when its successful its has no error but when i run it and log in successfully its terminating the program. Would you please help me identify the problem? thank you so much!

 Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim ID As String
        ID = InputBox("Please Enter Employee ID.", "LOG IN")
        If ID = "I.T-110" Then
            MessageBox.Show("Log In Successful!") 'when Successful
            Form5.Show()
            Me.Close()
        Else
            MsgBox("Sorry Wrong ID Number,Please try again!")
            attempts += 1
        End If

        If attempts = 3 Then 'Closes the login form if the user credentials fail three times
            MessageBox.Show("You have reached the allowed number of login attempts")
            Me.Close()
        End If
    End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.