When we press a key how can we get the item which starts with that letter be selected?(Data is not in a recordset)
Printable View
When we press a key how can we get the item which starts with that letter be selected?(Data is not in a recordset)
What is the STYLE property for the combo box set to? If you set it to 2 - Dropdown List then you don't have to do anything, it will do it for you.
eg: you can make an extra field (txtFind) where the user can type his text.
When he does so, via the txtFind_Change event, you send this to your listbox so that the matching text is selected.
Code:Public Declare Function sendMessageByString& Lib "user32" _
Alias "SendMessageA" (ByVal hwnd As Long, _
ByVal wMsg As Long, ByVal wParam As Long, _
ByVal lParam As String)
Private Sub txtFind_Change()
Dim lngEntryNum As Long
Dim strTxtToFind As String
strTxtToFind = txtFind.Text
lngEntryNum = sendMessageByString(List1.hwnd, &H18C, 0, strTxtToFind)
end sub