What I have is a small application that has a datagridview and an Access DB. There are 10 records in the database and they all show up in the datagridview when the app is launched. I need to be able to do two things:
I am able to choose the record with this:
Dim row As DataRow
row = ProductsDataSet.tblProducts.FindByItemNum(txtNumber.Text)
but I am unable to figure out how to show just that record in the DGV. (Let me clarify...I THINK I am choosing the record simply because no exceptions are being thrown).
Any guidance here would be greatly appreciated. Thank you.
John
An option is to set the dataSource of your dataGridView to the data you'd like to display. Below is an implementation using dataTables.
Class MyForm
Dim dataTableAll, dataTableOneID, As DataTable
Sub show1ID_Click
Dim id As Integer = InputBox("Enter ID")
dataTable2 = dataTable1.Select("[ID] = id").CopyToTable
dataGridView.DataSource = dataTableOneID
End Sub
Sub showAll_Click
dataGridView.DataSource = dataTableAll
End Sub
End Class
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments