Share via


CListCtrl::FindItem

Searches for a list view item having specified characteristics.

int FindItem( 
   LVFINDINFO* pFindInfo, 
   int nStart = -1  
) const;

Parameters

  • pFindInfo
    A pointer to an LVFINDINFO structure containing information about the item to be searched for.

  • nStart
    Index of the item to begin the search with, or -1 to start from the beginning. The item at nStart is excluded from the search if nStart is not equal to -1.

Return Value

The index of the item if successful or -1 otherwise.

Remarks

The pFindInfo parameter points to an LVFINDINFO structure, which contains information used to search for a list view item.

Example

      LVFINDINFO info;
        int nIndex;

        info.flags = LVFI_PARTIAL|LVFI_STRING;
        info.psz = _T("item");

        // Delete all of the items that begin with the string. 
        while ((nIndex = m_myListCtrl.FindItem(&info)) != -1)
        {
            m_myListCtrl.DeleteItem(nIndex);
        }

Requirements

Header: afxcmn.h

See Also

Reference

CListCtrl Class

Hierarchy Chart

CListCtrl::SortItems