Hello,
I have a ComboBox named comboBoxSelChannel.
I declared a structure named MySturct.
public struct MyStruct
{
public int Index;
public string Name;
}
I created a BindingList of MyStruct:
MyStruct myStruct = new MyStruct() ;
BindingList<MyStructmyList = new BindingList<MyStruct>();
I added 4 MyStruct elements to my BindingList:
myStruct.Name = "Name1" ;
myStruct.Index = 0;
myList.Add( myStruct );
myStruct.Name = "Name2";
myStruct.Index = 1;
myList.Add( myStruct );
myStruct.Name = "Name3";
myStruct.Index = 2;
myList.Add( myStruct );
myStruct.Name = "Name4";
myStruct.Index = 3;
myList.Add( myStruct );
I Binded the ComboBox to the BindingList:
comboBoxSelChannel.DataSource = myList;
comboBoxSelChannel.DisplayMember = "Name";
comboBoxSelChannel.ValueMember = "Index";
The ComboBox is showing 4 elements but instead of showing Name1, Name2,
Name3, Name4 it shows 4 times "MyStruct".
Any Idea why and what I am doing wrong here?
Thanks
Eitan