I have a combo box that contain objects from an instantiated class as p-code below. How do I get the selected object as well as set the selected object?
Class comboObj
Public name as string
Public value as integer
...
End Class
...
Dim item1 as New comboObj("name1",1);
Dim item2 as New comboObj("name2",2);
'I build the combo box (MyComboBox) as follow:
Me.MyComboBox.Items.Add(item1);
Me.MyComboBox.Items.Add(item2);
'Say some value in my program requires the second value to display as the selected value. How would I get item2 to display in the combobox as the selected value? If the user selected a new value in the combobox, how would I retrieve that value/object (comboObj)? Not just the displayed value but I want to retrieve the object (comboObj).
Hopefully that all makes sense.
Thanks,
Greg
Class comboObj
Public name as string
Public value as integer
...
End Class
...
Dim item1 as New comboObj("name1",1);
Dim item2 as New comboObj("name2",2);
'I build the combo box (MyComboBox) as follow:
Me.MyComboBox.Items.Add(item1);
Me.MyComboBox.Items.Add(item2);
'Say some value in my program requires the second value to display as the selected value. How would I get item2 to display in the combobox as the selected value? If the user selected a new value in the combobox, how would I retrieve that value/object (comboObj)? Not just the displayed value but I want to retrieve the object (comboObj).
Hopefully that all makes sense.
Thanks,
Greg