|
|
|
|
|
|
How to bind enum with ComboBox Control in C#
|
You have created an enum in C# and you want to bind the enum with the data bound controls such as ComboBox control. You can use GetValues() method of Enum class for this purpose as shown below:
|
public enum WeekDays
{
Mon, Tue, Wed, Thu, Fri, Sat, Sun
}
To bind the above enum with ComboBox control use the following: comboBox1.DataSource = Enum.GetValues(typeof(WeekDays));
|
RELATED HOW TOs
|
How to Create Enum in C#
|
|
|
|
|
|
|
|
|
|
|
|
|