I am working in vb.net and i have a simple requirement.
I have added a MDB file to a dataset and it contains 21 tables.
I have a datagridview and a combobox on my form.
I was able to get the combobox populated with the table names available in the dataset by iterating through dataset.tables.
Now i want to add the feature where the user can select the table name from the combo and then it should populate the contents of that table.
I tried the following Code
Datagridview1.DataSource = dataset1
Datagridview1.DataMember = dataset1.tables(combobox1.selecteditem)
Datagridview1.Refresh()
however that did not work and i was only getting the column headers. Then i read further that i needed a TableAdapter to populate the dataset with that table. When i encountered this i hit a road block, because then for every table i will have to use it's datatableadapter object and i won't be able to do it in a generic way.
Currently if i have to populate "TableA" then i will have to create an instance of Dataset1tableadapters.TableA and then use it's fill property to populate. Similarly i will have to do it again for "TableB". Is there not a generic methoed to populate any table in the dataset?