ToolStripComboBox + objects default string value
- by Martin
I am using a ToolStripComboBox to list some data. I am populating this combo with some custom objects:
For Each obj As myObject In myObjectList
myToolStripComboBox.Items.Add(obj)
Next
This works great except the text displayed in the combo is the name of the object class. I can understand why and realise that I need to do something to make the combo use a property from my class instead.
The help files state:
To add objects to the list at run
time, assign an array of object
references with the AddRange method.
The list then displays the default
string value for each object. You can
add individual objects with the Add
method.
The bit in bold suggests I need to setup the default string value in my class. How would I go about doing this?