VB 2005 - Filter List Box

Soldato
Joined
21 Jul 2004
Posts
6,360
Location
Harrow, UK
I have a list box populated with data from a directory listing (file names), and now I want to add a search box that will filter this list after every typed letter.

Does anyone know how to do this?
 
Code:
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
        If TextBox1.Text.Trim.Length > 0 Then
            ListBox1.SelectedIndex = ListBox1.Items.IndexOf(TextBox1.Text.Trim.ToUpper)
        Else
            ListBox1.SelectedIndex = -1
        End If
End Sub

I just tried that and it does nothing :(
 
Back
Top Bottom