C++/CLI How to I store Associated Data on ComboBox Item?

  • Thread starter Thread starter JEKATICH
  • Start date Start date
J

JEKATICH

How do I store associated data on a ComboBox item (ToolStripComboBox)?

The API and MFC has a (Set/Get)ItemData(Ptr), however, I do not see any such
animal in .NET.

Thanks

JEK
 
It seems that specific property has been taken away. See here for discussion
on VB, although I think it applies equally to C++/CLI if you ignore the stuff
about VB6:

http://support.microsoft.com/kb/311340

The way I would achieve this in C++/CLI is something like:

public ref class FooItem
{
private:
// my item data
public:
virtual String^ ToString() { /* return the text representation of the item
*/ }
};


mycombobox->Items->Add(gcnew FooItem);
 
Great solution!!!

One smop:

virtual String^ ToString() override { /* return the text representation of
the item */ }

Thanks
JEK
 
Back
Top