I have a dataset with tables that I’d like to import to a Combobox.
So basically I want to import each name of each table into my combobox.
This is for a Winform application
Would this be possible without having to add each name manually?
The reason for this is to able to select a table to later show the table in a datagrid.
Create Dictionary of TableName & Table (
Dictionary<string,DataTable>) and Bind it to ComboBox’s DataSource.Use
DisplayMember(To assign DisplayMember from DataSource) is the item in the datasource that is displayed in the ComboBox items.ValueMemeber(To assign ValueMember from DataSource) is the item in the DataSource that use as the actual value for the items.Code
OR
Use Linq query to create
Dictionary<string,DataTable>Here
Dictionaryused as DataSource.Dictionaryhave two propertyKey&Value. Key(TableName) used as DisplayMember & Value(DataTable) used as ValueMember.On comboBox
SelectedIndexChangedBind GridDataSource