3 attempt login in vb.net using console
Login using console in vb.net with 3 times attempt. The user prompt to login the system, once it reach a maximum attempts the program will automatically closed.
Private Sub login()
        Dim user As String
        Dim pass As String
        Dim x As Integer
        Dim log As Boolean = True
        While log
                Do While x < 3
                    Console.WriteLine("Enter username")
                    user = Console.ReadLine()
                    Console.WriteLine("Enter password")
                    pass = Console.ReadLine()
                    If user = "admin" And pass = "123" Then
                        Console.WriteLine("Welcome! You're logged in.")
                        Console.ReadLine()
                        log = False
                        Exit While
                    Else
                        x += 1
                        Console.WriteLine("===========Error============")
                        log = True
                    End If
                Loop
                Console.WriteLine("3 times attempt, the program will automatically closed!")
                Console.ReadLine()
                Exit While
        End While
    End Sub
This program is quite simple. Hope this is very helpful.
 
.jpg) 
 
 
 
 
 
 
 
