int SetItemData( int nIndex, DWORD dwItemData );
Return Value
CB_ERR if an error occurs.
Parameters
nIndex
Contains a zero-based index to the item to set.
dwItemData
Contains the new value to associate with the item.
Remarks
Sets the 32-bit value associated with the specified item in a combo box. Use the SetItemDataPtr member function if the 32-bit item is to be a pointer.
Example
// The pointer to my combo box.
extern CComboBox* pmyComboBox;
// Set the data of each item to be equal to its index.
for (int i=0;i < pmyComboBox->GetCount();i++)
{
pmyComboBox->SetItemData(i, i);
}
CComboBox Overview | Class Members | Hierarchy Chart
See Also CComboBox::GetItemData, CComboBox::GetItemDataPtr, CComboBox::SetItemDataPtr, CB_SETITEMDATA, CComboBox::AddString, CComboBox::InsertString