Return to Snippet

Revision: 45606
at May 4, 2011 23:52 by Maikel


Initial Code
var query = (from int n in Enum.GetValues(typeof(System.Windows.Forms.DialogResult))
 			 select new {
						 n,
	 					 Key = Enum.GetName(typeof(System.Windows.Forms.DialogResult),n) 
 						}
			);

comboBox1.DataSource = query.ToList();
comboBox1.DisplayMember = "key";
comboBox1.ValueMember = "n";

Initial URL

                                

Initial Description

                                

Initial Title
Bind Enum to Combobox

Initial Tags

                                

Initial Language
C#