| Make a new project. Add a module. To the form add a command button, a list box and a text box. Code: Add this code to the module: Option Explicit Private Declare Function SendMessage Lib "User32" Alias "SendMessageA" _ (ByVal hWnd As Long, ByVal wMsg As Integer, ByVal wParam As Integer, lParam _ As Any) As Long Const LB_FINDSTRING = &H18F Add this code to the form's Load procedure: Private Sub Form_Load() With List1 .Clear .AddItem "CPU" .AddItem "RAM" .AddItem "ROM" .AddItem "Cache" .AddItem "Motherboard" .AddItem "Hard Disk" .AddItem "Floppy Disk" End With End Sub Add this code to the text box's Change procedure: Private Sub Text1_Change() List1.ListIndex = SendMessage(List1.hWnd, LB_FINDSTRING, -1, ByVal _ Text1.Text) Text1.Text = List1.Text End Sub |
Search a Listbox |
Express News India | Freelance ecommerce web development India