hi every 1 i am trying to make a search criteria based on last name.i have dragged and dropped customer dataset as details view on my form and booking as gridview(customer id is foreign key in bookings table so now when i scroll through customer i could see the relaive booking history in grid view.). now i have many customer so i have to scroll down to look for a particular customer. i want to create a textbox where i can enter customer's last name and it should change the data of details view from current customer to the customer which is searched and also should change the related data in gridview aswell which is customer booking data.really need help plz..provide code if u can..here is wat i have done but no luck.
Dim ds As DataSet
'** means:
'check for correct name of the table in dataset, you can still use index like [0] if this is 1st or only table in dataset
'class variable where you have all the data of customers and its bind to datagridview
Private Sub DoTheFiltering()
Dim filter As String = txtCustSearchNewBooking.Text
Dim query As String = "LastName like '%" & filter & "'"
Dim rows() As DataRow = ds.Tables("Customers").Select(query)
'**
Dim tableNew As DataTable = New DataTable("SelectedCustomers")
'create columns for table:
For Each column As DataColumn In ds.Tables("Customers").Columns
tableNew.Columns.Add(New DataColumn(column.ColumnName, GetType(System.String)))
Next
'adding rows to table:
For Each row As DataRow In rows
new_bookingdataset.booking.ImportRow(row)
Next
dataGridView.DataSource = Nothing
'resetting datasource
dataGridView.DataSource = ne
BindingSource(tableNew, Nothing)
End Sub