Make sure the ListViews HideSelection Property is False, then use this slightly Modified version of my code:
Code:Private Sub Text1_KeyPress(KeyAscii As Integer) Static sWord As String Dim iIndex As Long Dim tLVFI As LV_FINDINFO Dim iPos As Integer sWord = sWord & Chr(KeyAscii) tLVFI.flags = LVFI_PARTIAL Or LVFI_STRING tLVFI.psz = sWord iIndex = SendMessage(ListView1.hwnd, LVM_FINDITEM, -1, tLVFI) If iIndex < 0 Then sWord = Chr(KeyAscii) tLVFI.psz = sWord iIndex = SendMessage(ListView1.hwnd, LVM_FINDITEM, -1, tLVFI) End If If iIndex < 0 Then sWord = "" Else Set ListView1.SelectedItem = ListView1.ListItems(iIndex + 1) End If iPos = Text1.SelStart Text1 = sWord Text1.SelStart = iPos + 1 KeyAscii = 0 End Sub
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]




Reply With Quote