473,320 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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

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

Feb 27 '07 #1
2 3048
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);
Mar 1 '07 #2
Great solution!!!

One smop:

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

Thanks
JEK
"mclp" <mc**@discussions.microsoft.comwrote in message
news:07**********************************@microsof t.com...
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);

Mar 3 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Colin Steadman | last post by:
Hope this makes sense! I'm building an ASP page which allows uses to add items to an invoice via a form, ie: Item No Part No Order No Quanity Units Price VAT ------- ...
2
by: VMI | last post by:
Is it possible to display something in a combobox and store something else? For example, can I display "Query for active employees" and save the actual query in the same combobox item? That way...
4
by: Strahimir Antoljak | last post by:
Has anyone experienced problems with a combo box SelectIndex property? Is there a limit to the number of Items for a combo box? Namely, when I set programmatically ComboBox.SelectIndex...
2
by: Jeremy Dillinger | last post by:
I have a program setup to pull data from a database. My database table has things such as (category, Item, price, etc.) In my program I want to have multiple list boxes that will have a pull down...
4
by: Joe Schmoe | last post by:
All I want to to be able to take a two-column DataReader (One column with the Item ID number, the other with Item Description text) and load it into a Windows Forms ComboBox (Set to DropDownList...
5
by: =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= | last post by:
I want to create a customized ComboBox where the methods ComboBox.Items.Add and ComboBox.Items.Insert will behave thusly: -- If the item is not present, add it. -- If the item is present, set the...
2
by: spowel4 | last post by:
Here's my code thus far: Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim objxmldoc As New Xml.XmlDataDocument() 'Load all customer numbers...
0
by: XenReborn | last post by:
Ok this should be simple. I made a form, added a combobox (for selecting items to edit, not for updating fields), several textboxes, a few checkboxes etc. On formshow it connects to my database,...
0
by: Man4ish | last post by:
Hi, I am using multiple combo list (2 here). I want to store the selected item by these two combo boxes in an array list to check that same value should not be selected by two. This way i am...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.