1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| Option Explicit
Private Sub Form_Load()
Me.Caption = "Form log et mot de passe"
TextLog.Text = "": TextMotPass.Text = ""
TextMotPass.PasswordChar = "*"
End Sub
Private Sub Command1_Click()
Static Cpt As Integer
If TextLog.Text = "MonLog" And TextMotPass.Text = "Passe" Then
FormSuivante.Show
Unload Me
Else
Cpt = Cpt + 1
If Cpt = 3 Then
MsgBox "Troisième essais non conforme, arrêt du programme", vbCritical, "Entrée non conforme"
Unload Me
Else
TextLog.Text = "": TextMotPass.Text = ""
MsgBox "Log et mot de passe incorrecte", vbCritical, "Entrée non conforme"
TextLog.SetFocus
End If
End If
End Sub
Private Sub TextLog_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then KeyAscii = 0: TextMotPass.SetFocus
End Sub
Private Sub TextMotPass_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then KeyAscii = 0: Command1_Click
End Sub |
Partager