You dont need a Do Loop for this unless you are doing other calculations.
At your Form or UserControl, where the Button of Login is present add;
Dim attempts As Integer = 0
Dim userName As String = "user123"
Dim password As String = "12345"
Private Sub btLogin_Click(sender As Object, e As EventArgs) Handles btLogin_Click
If attempts >=3 Then
MsgBox("You reached the maximum attempts to log in!")
If (textBoxUserName.Text = userName) AndAlso (textBoxPasword.Text = password) Then