VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Find ListIndex of an item in a Combo/List box without iterating through the list

by BB (1 Submission)
Category: Custom Controls/Forms/Menus
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Tue 23rd December 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Find ListIndex of an item in a Combo/List box without iterating through the list

API Declarations


Const CB_FINDSTRING = &H14C

Rate Find ListIndex of an item in a Combo/List box without iterating through the list



findIt= "....Your string goes here..." 'whatever string you are looking for
i = SendMessage(cboCust(0).hWnd, CB_FINDSTRING, -1, ByVal findIt) 
If i > -1 Then cboCust(0).ListIndex = i

'note the string must be passed ByVal and cannot be a reference (e.g to a field 
'in a recordset etc...)
'Returns -1 if not found


Download this snippet    Add to My Saved Code

Find ListIndex of an item in a Combo/List box without iterating through the list Comments

No comments have been posted about Find ListIndex of an item in a Combo/List box without iterating through the list. Why not be the first to post a comment about Find ListIndex of an item in a Combo/List box without iterating through the list.

Post your comment

Subject:
Message:
0/1000 characters