CComboBox::SetItemDataPtr

int SetItemDataPtr( int nIndex, void* pData );

Return Value

CB_ERR if an error occurs.

Parameters

nIndex

Contains a zero-based index to the item.

pData

Contains the pointer to associate with the item.

Remarks

Sets the 32-bit value associated with the specified item in a combo box to be the specified pointer (void*). This pointer remains valid for the life of the combo box, even though the item’s relative position within the combo box might change as items are added or removed. Hence, the item’s index within the box can change, but the pointer remains reliable.

Example

// The pointer to my combo box.
extern CComboBox* pmyComboBox;

// Set the data pointer of each item to be NULL.
for (int i=0;i < pmyComboBox->GetCount();i++)
{
   pmyComboBox->SetItemDataPtr(i, NULL);
}

CComboBox OverviewClass MembersHierarchy Chart

See Also   CComboBox::GetItemData, CComboBox::GetItemDataPtr, CComboBox::SetItemData, CB_SETITEMDATA, CComboBox::AddString, CComboBox::InsertString