VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Searching ListBox for typed Characters in TextBox and selecting if match found

by Karnam Bhanu Prakash (4 Submissions)
Category: Windows API Call/Explanation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 28th March 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Searching ListBox for typed Characters in TextBox and selecting if match found

API Declarations



Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const LB_FINDSTRING = &H18F


Rate Searching ListBox for typed Characters in TextBox and selecting if match found



Private Sub Form_Load()
    List1.Clear
    List1.AddItem "India"
    List1.AddItem "Italy"
    List1.AddItem "USA"
    List1.AddItem "UK"
    List1.AddItem "Iraq"
    List1.AddItem "London"
    List1.AddItem "Paris"
    List1.AddItem "New Delhi"
End Sub

Private Sub Text1_Change()
    List1.ListIndex = SendMessage(List1.hwnd, LB_FINDSTRING, ByVal &O0, ByVal CStr(Text1.Text))
End Sub

Download this snippet    Add to My Saved Code

Searching ListBox for typed Characters in TextBox and selecting if match found Comments

No comments have been posted about Searching ListBox for typed Characters in TextBox and selecting if match found. Why not be the first to post a comment about Searching ListBox for typed Characters in TextBox and selecting if match found.

Post your comment

Subject:
Message:
0/1000 characters