How to search a listbox with VB

For this project I use:
ListBox1
ListBox2
Button1
TextBox1
vb.net-how to search a listbox

  • Copy/paste
 Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        With ListBox1.Items

            .Add("My name is Jimmy")

            .Add("I am from California")

            .Add("I go to UCLA")

            .Add("I like porgramming in VB 2008")

            .Add("I love Visual Basic language")

            .Add("This tutorial shows you how to search a listbox ")

        End With

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        ListBox2.Items.Clear()

        Dim count As Integer = (ListBox1.Items.Count - 1)

        Dim words, wordsB As String

        Dim spaceCharCounter As Integer = 0

        For i = 0 To count

            words = ListBox1.Items.Item(i)

            For j = 0 To words.Length - 1

                If spaceCharCounter >= 2 Then

                    wordsB += words.Substring(j, 1)

                ElseIf words.Substring(j, 1) = Chr(32) Then

                    spaceCharCounter += 1

                End If

            Next

            If InStr(wordsB, TextBox1.Text) Then

                ListBox2.Items.Add(ListBox1.Items.Item(i))

            End If

            words = Nothing

            spaceCharCounter = 0

            wordsB = Nothing

        Next

    End Sub

End Class