hi im new to vb and i would like to create a good log on form to access a database. i would appreciate some guidance for creating a log on form and a search form for the database, tnx :)

u must b use data reader command we use oledbdatareader in vb.net
sample code is here vb.net

dr(1) is username column
dr(2) is password column
textbox1.text = password column

Imports System.Data.OleDb
Public Class Form14
Dim cn As OleDbConnection
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader
Dim str As String
Dim icount As Integer

Private Sub Form14_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Try
cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\inventory\WindowsApplication1\inventory.mdb;")
cn.Open()
cmd = New OleDbCommand("select * from loginwindow", cn)
dr = cmd.ExecuteReader
While dr.Read
ComboBox1.Items.Add(dr(1))
End While
Catch ex As Exception
End Try
cn.Close()
dr.Close()
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
End
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
If ComboBox1.Text = "" Then
MsgBox("Enter Must Be User Name")
Else
Try
cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\inventory\WindowsApplication1\inventory.mdb;")
cn.Open()
cmd = New OleDbCommand("select * from loginwindow", cn)
dr = cmd.ExecuteReader
While dr.Read
If ComboBox1.Items.Item(ComboBox1.SelectedIndex) = dr(1) Then
If TextBox1.Text <> dr(2) Then
MsgBox("Wrong Password Enter Right Password")
Else
Form1.Show()
Me.Hide()
End If
End If
End While
Catch ex As Exception
End Try
End If
Catch ex As Exception
End Try
cn.Close()
dr.Close()
End Sub
End Class

i think this is your answer best of luck

how to do a log in form for inventory system ??

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.