I have a CComboBox object. I need to set one or more of its strings to represent a *double* data type. For example:


CComboBox mCbbCandy;

mCbbCandy.Create(WS_CHILD | WS_VISIBLE | WS_BORDER | LBS_NOTIFY | WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT, CRect(CPoint(270, 10), CSize(100, 100)), this, IDC_CBB_FLAVORS);

// Setting its value
int i = mCbbCandy.AddString("X");
mCbbCandy.SetItemData(i, 1.99); // $1.99

// Retrieving its value

int i = mCbbCandy.GetCurSel();
double price = mCbbCandy.GetItemData(i);


For some reason, the price does not come out right if I use the decimal point. For example, any whole number works, but not decimal.

How do you set the item data to a double type? Visual C++ gave warnings about data loss because the CComboBox object expected a DWORD instead of a double.