Click to See Complete Forum and Search --> : Listbox text selection
AndyK
September 25th, 2001, 05:40 PM
Hello,
I need to highlight text in the listbox based on what was typed in the combobox, but the
List1.ListIndex = SendMessage(List1.hwnd, LB_SELECTSTRING, -1, Combo1.Text)
Doesn't work for some reason. What am I doing wrong? Thank You
MKSa
September 25th, 2001, 07:14 PM
Change your declaration of SendMessage to:public Declare Function SendMessage Lib "user32" _
Alias "SendMessageA" _
(byval hWnd as Long, _
byval wMsg as Long, _
byval wParam as Long, _
lParam as Any) as Long
AndyK
September 25th, 2001, 08:15 PM
yeah, that's exactly what I have and still no idea why it won't work. Thanks for the help.
Iouri
September 26th, 2001, 08:14 AM
I tried your code. It works if you change the line to the following
List1.ListIndex = SendMessage(List1.hWnd, LB_SELECTSTRING, -1, ByVal CStr(Combo1.Text))
Iouri Boutchkine
iouri@hotsheet.com
DSJ
September 26th, 2001, 08:24 AM
the fourth parameter (the string to search for) also has to be passed ByVal...
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.