Bonjour tout le monde
Svp .. j'ai besoin d'aide pour ajouter cette ligne dans le bon endoit .. j'ai beaucoup essaye mais sans resultat
Code : Sélectionner tout - Visualiser dans une fenêtre à part
MessageBox.Show("Wrong Password  [" & Ccounter - 1 & "]  Attempt(s) Remaing")
Mon code login :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
 Public Ccounter As Integer = 0
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
    Private Sub Login(ByVal Users_Name As String, ByVal Users_Password As String)
        Dim Cmd As New SqlCommand("SELECT * From Tableusers  where employeName = @employeName and employePassword = @employePassword", Conne)
        Cmd.Parameters.Add("@employeName", SqlDbType.VarChar).Value = Users_Name
        Cmd.Parameters.Add("@employePassword", SqlDbType.VarChar).Value = Users_Password
        If Conne.State = ConnectionState.Closed Then Conne.Open()
        Dim reader As SqlDataReader = Cmd.ExecuteReader()
        Dim loginSuccess As Boolean = False
        While (reader.Read())
            loginSuccess = True
            MDIParent1.Label1.Text = reader("EmployeFullName")
        End While
        If (loginSuccess) Then
            Ccounter = 0
            MessageBox.Show("Welcome")
            MDIParent1.Show()
            Me.Close()
        Else
            Ccounter += 1
            'MessageBox.Show("Wrong Password  [" & Ccounter - 1 & "]  Attempt(s) Remaing")
            If Ccounter = 3 Then
                MessageBox.Show("Too many invalid login attempts.. Program will be closed")
                Button1.Enabled = False
                End
            Else
                MessageBox.Show("The username or password is incorrect")
            End If
        End If
        If Conne.State = ConnectionState.Open Then Conne.Close()
    End Sub
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Login(Me.TextBox1.Text, Me.TextBox2.Text)
    End Sub
Merci beaucoup d'avance pour l'aide
Cordialement
MADA