i am trying to do a for loop to give the user 3 trys to get the login username and password right. the username is User and the Password is VB. the code i got so far is a if function
Code:Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click 'Stores MainForm in memory as New Form Dim MainForm As New frmCustomerDetails Dim strUsername As String = "User" Dim Password As String = "VB" strUsername = txtUsername.Text Password = txtPassword.Text For counter As Integer = 1 To 3 If strUsername = "User" And Password = "VB" Then Username = txtUsername.Text frmLoginForm.ActiveForm.Hide() MainForm.Show() MessageBox.Show("Login Success", "Login") Exit For Else 'if Login Failed Popup message Box and clear textboxes for retry MessageBox.Show("Login Failed, Please Try Again", "Login") counter += 1 txtUsername.Clear() txtPassword.Clear() txtUsername.Focus() End End If Next counter End Sub


LinkBack URL
About LinkBacks




Reply With Quote



Bookmarks