Hi there.
I've got a checkedListBox i want to fill with objects, but in every line in the checkedListBox should not show the object, but a describing text.
I.e.I got a class:
public class myData
{ private string Name;
private string Age; }
I fill the Listbox like this:
objMyData = new myData();
objMyData.Name="Michael";
objMyData.Age=26;
checkedListBox1.Items.Add(objMyData);
objMyData = new myData();
objMyData.Name="Peter";
objMyData.Age=28;
checkedListBox1.Items.Add(objMyData);
This works ok, but it doesn't look very nice in the box, it shows the class, and I want it to show just the property Name (i.e."Michael"), or any good text I chose, but when I chose one item I want to get the object, and not just the name.
Is there anyway to do this at all? I have tried with stuff like DisplayMember and so, but it don't work.
/Erik