Skip to main content

Write a program in VB for Login screen validation.(use ADODC Control)

· One min read
Kaustubh Kulkarni

file.vb
Private Sub cmdok_Click()  
Static y As Integer
Adodc1.Refresh
With Adodc1.Recordset

If .RecordCount > 0 Then
If .EOF = False Then
.MoveFirst
If !UserName = txtUsername And !Password = txtPassword Then
MsgBox "Login Successful!"
frmMenu.Show
Unload Me

Else
MsgBox "Invalid username/password!", vbOKOnly + vbCritical, "Access denied!"
txtUsername.Text = ""
txtPassword.Text = ""
txtUsername.SetFocus
End If
End If
End If
End With
End Sub