CListBox::SetItemData

Sets a 32-bit value associated with the specified item in a list box.

int SetItemData( 
   int nIndex, 
   DWORD_PTR dwItemData  
);

Parameters

  • nIndex
    Specifies the zero-based index of the item.

  • dwItemData
    Specifies the value to be associated with the item.

Return Value

LB_ERR if an error occurs.

Example

// Set the data of each item to be equal to its index. 
for (int i=0;i < m_myListBox.GetCount();i++)
{
   m_myListBox.SetItemData(i, i);
}

Requirements

Header: afxwin.h

See Also

Reference

CListBox Class

Hierarchy Chart

CListBox::SetItemDataPtr

CListBox::GetItemData

LB_SETITEMDATA