Description:
Validate the textbox control whether it has valid data or not, from database
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Pb1.Value = 0
If i > 2 Then
MsgBox("Please Contact your Administrator")
End
Else
cmd = New OleDbCommand("select * from login where uid='" & txtuser_name.Text & "' and password='" & txtpassword.Text & "' ", con)
ad = New OleDbDataAdapter(cmd)
d = New DataSet
ad.Fill(d)
If d.Tables(0).Rows.Count <> 0 Then
Timer1.Enabled = True
'Me.Hide()
Else
MsgBox("Please Check the User Name And Password", MsgBoxStyle.Information + vbOKOnly)
txtpassword.Text = ""
txtpassword.Focus()
End If
End If
i = i + 1
Catch ex As Exception
MsgBox(ex.Message)
i = i + 1
End Try
End Sub

|