Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Collapse the table of content
Expand the table of content


Sets the 32-bit application-specific value associated with the item specified by nItem.

BOOL SetItemData(
   int nItem,
   DWORD_PTR dwData 


Index of the list item whose data is to be set.


A 32-bit value to be associated with the item.

Nonzero if successful; otherwise 0.

This value is the lParam member of the LVITEM structure, as described in the Windows SDK.

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

Header: afxcmn.h

Community Additions

© 2015 Microsoft