PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Peter House on December 23, 2010, 01:40:04 PM

Title: Search Combo or List by ItemData
Post by: Peter House on December 23, 2010, 01:40:04 PM
Is there a way to search a Listbox or ComboBox for the first Match by ItemData instead of by text ???

How About searching a ListView by ItemData or SubItem lParam?

Thanks,

Peter House
Title: Re: Search Combo or List by ItemData
Post by: Paul Squires on December 23, 2010, 01:44:32 PM

'--------------------------------------------------------------------------------
Function ItemInListBox( ByVal hListBox As Dword, ByVal nItem As Long ) As Long
   
   Local nFound As Long
   Local nCount As Long
   Local i      As Long
   
   nFound = -1
   
   nCount = FF_ListBox_GetCount( hListBox )
   
   For i = 0 To nCount - 1
      If FF_ListBox_GetItemData( hListBox, i ) = nItem Then
         nFound = i
         Exit For
      End If
   Next

   Function = nFound

End Function