Auto select in listbox when user types in textbox

  • Thread starter Thread starter Sheldon
  • Start date Start date
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!
 
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?
 
Back
Top