hi
suppose all your cd's are listed in a listbox
this is the fastest way to find a name.
use:
-
Const LB_FINDSTRING = &H18F
-
Const LB_FINDSTRINGEXACT = &H1A2
-
Din LstNdx as Integer
-
-
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As String) As Long
-
in your delclaration.
then use:
-
LstNdx = SendMessage(lstCDs.hWnd, LB_FINDSTRING, -1, txtCDName.Text)
-
' to look up the listindex of the cd to find
-
txtCDName.Text=lstCDs.List(LstNdx)
-
' to get the whole text
-
if you call the code above from txtCDName_Change, the text will change after every keystroke (annoying)
better create a button to trigger the code.
or call from
-
Private Sub txtCDName_KeyDown(KeyCode As Integer, Shift As Integer)
-
if KeyCode=VBKeyReturn then
-
txtCDName.Text=lstCDs.List(LstNdx)
-
End If
-