WinForms bind Combobox to DataSet Table Names
-
Is there an easy way to bind a combobox to populate with the names of the tables in a given dataset? When I search all I am finding are questions and examples of binding to a datatable, not the names of the tables in a dataset. I was hoping for something similar to when debugging in Visual Studio and you have a watch on a dataset. When you examine the value, you get a dropdown with the table names, and switching will show you the data table in a datagrid view. I currently clear the items from the combobox, and iterate through the table names adding them to the combobox. When the combobox changes I then set my datamember of my grid view to be dataset[combobox1.SelectedItem.ToString], which works but feels clunky. My application will be using different typed datasets so I need to be able to change the combobox when the dataset changes.
-
Is there an easy way to bind a combobox to populate with the names of the tables in a given dataset? When I search all I am finding are questions and examples of binding to a datatable, not the names of the tables in a dataset. I was hoping for something similar to when debugging in Visual Studio and you have a watch on a dataset. When you examine the value, you get a dropdown with the table names, and switching will show you the data table in a datagrid view. I currently clear the items from the combobox, and iterate through the table names adding them to the combobox. When the combobox changes I then set my datamember of my grid view to be dataset[combobox1.SelectedItem.ToString], which works but feels clunky. My application will be using different typed datasets so I need to be able to change the combobox when the dataset changes.