با سلام ..
توضیحات سریع می دم
1. اتصال بانک به برنامه از کد
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db.mdb;"
Adodc1.RecordSource = "Select * from NameTabel"
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
کد کد بالا بانک رو لود سپس در دیتا گرید نمایش می دهد ..
برای اینکه فقط از اعداد جستجو و یا ثبت کنید از کد زیر استفاده کن
Private Sub Text1_KeyPress(KeyAscii As Integer)
Dim StrValid As String
StrValid = "0123456789-/\"
KeyAscii = Asc(UCase(Chr(KeyAscii)))
If KeyAscii > 26 Then
If InStr(StrValid, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
End If
End Sub
برای جستجو از تکست در دیتا گرید بانک هم از این کد استفاده کن
If Text1.Text = "" Then
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db.mdb;"
Adodc1.RecordSource = "Select * from nametabel"
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
End If
If Text1.Text <> "" Then
ado.RecordSource = "Select *from dast where code like'" & Text1.Text & "%'"
ado.Refresh
Exit Sub
End If