How To Bind Enum To ComboBox In WinForms Using C#

How To Bind Enum To ComboBox In WinForms Using C#

Added by Sixth Sense updated on Thursday, December 7, 2017

Problem:

Sometimes it is required to bind enum to combobox in winforms.The following code snippet demonstrates how to bind enum to combobox in winforms using c#.

From Convert Enum To Dictionary

comboBox1.DataSource = new BindingSource(DictionaryFromEnum(typeof(FormWindowState)), null);
comboBox1.DisplayMember = "Value";
comboBox1.ValueMember = "Key";					
				

Result:

bind enum to combobox

About

29 Tutorials
25 Snippets
6 Products

More

Contact Us

Contact us

Stay Connected