Auto select in listbox when user types in textbox

S

Sheldon

Help!

I used to user the following code in VB6 to scroll the listbox in response
to a user typing in text:

In a module:

Public Declare Function SendMessage Lib "user32" _
Alias "SendMessageA" (ByVal hwnd As Long, _
ByVal wMsg As Long, ByVal wParam As Long, _
ByVal lParam As String) As Long

Public Const LB_SELECTSTRING = &H18C

In a form:

Private Sub txtLstAll_Change()
If txtLstAll.Text <> "" Then
SendMessage lstAll.hwnd, LB_SELECTSTRING, -1, txtLstAll.Text
End If
End Sub

I tried this in the NEW IMPROVED Visual Studio 2008, using vb and I am
getting the following error message:

'hwnd' is not a member of 'System.Windows.Forms.ListBox'.

Does anyone know if there Is there a way of doing this in 2008? ANY help or
if you could point me in the right direction to find something would really
be appreciated!
 
J

Jeff Gaines

I tried this in the NEW IMPROVED Visual Studio 2008, using vb and I am
getting the following error message:

'hwnd' is not a member of 'System.Windows.Forms.ListBox'.

Does anyone know if there Is there a way of doing this in 2008? ANY help
or
if you could point me in the right direction to find something would really
be appreciated!

Isn't it called handle, i.e. lstAll.Handle?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top