0% found this document useful (0 votes)
51 views

Oledb Connection

This code defines a login class that handles user authentication. It contains methods for the login button click event, form load event, and a timer tick event. When the login button is clicked, it queries the database to check if the username and password match, and if so, shows a progress bar while navigating to the home form using a timer. If credentials are invalid, it clears the text boxes and shows an error message.

Uploaded by

agilan
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views

Oledb Connection

This code defines a login class that handles user authentication. It contains methods for the login button click event, form load event, and a timer tick event. When the login button is clicked, it queries the database to check if the username and password match, and if so, shows a progress bar while navigating to the home form using a timer. If credentials are invalid, it clears the text boxes and shows an error message.

Uploaded by

agilan
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

Imports System.Data.

OleDb
Public Class login
Dim con As OleDbConnection
Dim val As Boolean
Dim sel As OleDbCommand
Dim reader As OleDbDataReader
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
sel = New OleDbCommand("select * from login where user='" &
TextBox1.Text & "'and pass='" & TextBox2.Text & "' ", con)
reader = sel.ExecuteReader
While reader.Read
val = True
End While
If val Then
ProgressBar1.Visible = True
Timer1.Enabled = True
Else
TextBox1.Text = ""
TextBox2.Text = ""
MsgBox("Type correct password")
End If
End Sub

Private Sub login_Load(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles MyBase.Load
con = New
OleDbConnection("provider=microsoft.jet.oledb.4.0;data
source=F:\11666\project\dictionary\dictionary.mdb")
con.Open()
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Timer1.Tick
ProgressBar1.Value = ProgressBar1.Value + 5
If ProgressBar1.Value = 100 Then
Timer1.Enabled = False
ProgressBar1.Visible = False
home.Show()
Me.Hide()
End If
End Sub

End Class

You might also like