Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

windows forms link listbox to array

List<MyClass> listToBind = new List<MyClass> { new MyClass(1, "One"), new MyClass(2, "Two") };
this.listBox1.DisplayMember = "Text";
this.listBox1.ValueMember = "Id"; // optional depending on your needs
this.listBox1.DataSource = listToBind;
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #windows #forms #link #listbox #array
ADD COMMENT
Topic
Name
9+2 =