Hi,
The dataview has a find method. It will return the record number of
the first record that matches in a sorted column. Here is an example.
Dim dv As DataView
Dim cm As CurrencyManager
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim conn As OleDbConnection
Dim strConn As String
Dim strSQL As String
Dim ds As New DataSet
Dim daCustomers As OleDbDataAdapter
strConn = "Provider = Microsoft.Jet.OLEDB.4.0;"
strConn += "Data Source = Northwind.mdb;"
conn = New OleDbConnection(strConn)
daCustomers = New OleDbDataAdapter("Select * from Customers", conn)
daCustomers.Fill(ds, "Customers")
dv = New DataView(ds.Tables("Customers"))
cm = CType(Me.BindingContext(dv), CurrencyManager)
DataGrid1.DataSource = dv
dv.Sort = "CustomerID"
End Sub
Private Sub btnFind_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnFind.Click
Dim x As Integer
x = dv.Find(txtFind.Text)
If x >= 0 Then
cm.Position = x
Else
MessageBox.Show("Not found")
End If
End Sub
Ken
------------------------
"Aaron" <ku*****@yahoo.com> wrote in message
news:Ol**************@TK2MSFTNGP11.phx.gbl...
I'm new to VB.NET
The data form wizard automatically generates a set of textboxes from the
columns of my database and has update, delete, load buttons. I would like
to
add a search box and button.
when i type an id number in the search box and click the search button,
the
other textboxes should display their values where id = the number i typed
in.
and do nothing if there's no such record.
THanks