0
如何把我的日誌代碼循環它就像程序將結束,如果用戶第三次輸入一個錯誤的密碼/用戶名?VB 2010登錄3次循環
在這一點上,我很難把循環代碼。
這是VB我登錄代碼2010
Private Sub btnLogIn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogIn.Click
Me.Refresh()
Dim login = Me.TblUserTableAdapter1.UsernamePasswordString(txtUser.Text, txtPass.Text)
If login Is Nothing Then
MessageBox.Show("Incorrect login details", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
Dim ok As DialogResult
ok = MessageBox.Show("Login Successful", "Dantiña's Catering Maintenance System", MessageBoxButtons.OK, MessageBoxIcon.Information)
MMenu.Show()
MMenu.lblName.Text = "Welcome " & Me.txtUser.Text & " !"
If txtPass.Text <> "admin" Then
MMenu.Button1.Enabled = False
ProdMaintenance.GroupBox1.Visible = True
MMenu.Button2.Enabled = True
MMenu.Button3.Enabled = True
MMenu.Button4.Enabled = True
Else
MMenu.Button1.Enabled = True
ProdMaintenance.GroupBox1.Visible = True
MMenu.Button2.Enabled = True
MMenu.Button3.Enabled = True
MMenu.Button4.Enabled = True
End If
Me.Refresh()
Me.Hide()
End If
End Sub