Bind a dataset to a combo box in C#
The DataSet is a memory-resident representation of data that provides a consistent relational programming model regardless of the data source. The C# SqlDataAdapter object allows us to populate Data Tables in a DataSet. Also we can populate a combo box from a dataset values.
Bind data source to ComboBox
Select Item from ComboBox
The following C# program retrieve the values from database and store it in a dataset and later bind to a combobox.
Binding a ComboBox to an Enum values
Enum provide a convenient way in which to create a group of related constants that can be viewed as strings or integer values. When these values are bind to a ComboBox, the end user can select an option directly from a list of the Enum strings.
Data Binding an Enum with Descriptions
The follwoing C# program bind a combobox with Enum values.
Bind a ComboBox to a generic Dictionary
A Dictionary class is a data structure that represents a collection of keys and values pair of data. The key is identical in a key-value pair and it can have at most one value in the dictionary, but a value can be associated with many different keys.
Dictionary as a Combobox Datasource
The following C# program populating a Combobox from a Dictionary .
- What is C# ADO.NET Dataset
- C# Datset with Sql Server Data Provider
- C# Datset with OLEDB Data Provider
- Find Tables in a Dataset - Sql Server
- Find Tables in a Dataset - OLEDB
- How to Dataset rows count - Sql Server
- How to Dataset rows count - OLEDB
- How to find Column Definition SqlServer
- How to find Column Definition OLEDB
- How to Dyanamic Dataset in C#
- C# Dataset with multiple tables - Sql Server
- C# Dataset with multiple tables - OLEDB
- C# Dataset table relations
- C# Dataset merge tables - Sql Server
- C# Dataset merge tables - OLEDB
- How to find tables in a Database in C#