Z
zfeld
How do I add objects to a comboBox?
What I need is something similar to what there was in MFC as
MyObj obj;
ComboBox cb;
int index = cb.Add(obj.name);
cb.AddItemData(&obj, index);
Which can then be retrieved as:
int selectedIndex = cb.GetSelectedIndex();
MyObj selctedObj = reinterpret_cast<MyObj >(cb.GetItemData(selectedIndex ));
Is there any way to store a reference to the object in a C# ComboBox?
What I need is something similar to what there was in MFC as
MyObj obj;
ComboBox cb;
int index = cb.Add(obj.name);
cb.AddItemData(&obj, index);
Which can then be retrieved as:
int selectedIndex = cb.GetSelectedIndex();
MyObj selctedObj = reinterpret_cast<MyObj >(cb.GetItemData(selectedIndex ));
Is there any way to store a reference to the object in a C# ComboBox?