My boss recently converted to Windows Vista and likes its new search function. The search starts as soon as you start typing. As you type in more characters the search is refined. Now, it's my job to replicate this function.

The good news is that I'm only searching one table. The bad news is that the table is pretty big (~100000 rows).

I read the table into a dataset when the application opens. Then I update a listview when the textbox_textchanged event fires. This is really slow and blocks keyboard entry until the search is complete. As I enter more data the search does get faster but I need a way to cancel the event if I keep typing.

Another thing that may be slowing down the listview fill is the way that I am populating it.
Code:
        Dim strQry As String
        Dim drDef() As DataRow

        ListView1.Items.Clear()
        strQry = TextBox1.Text
        drDef = ds.Tables("vars").Select("myVar LIKE '" & strQry & "*'")

        For Each dr As DataRow In drDef
            lviVar = ListView1.Items.Add(dr("myVar").ToString)
            With lviVar
                .SubItems.Add(dr("desc").ToString)
                .SubItems.Add(dr("sys").ToString)
            End With
        Next
I think that things would be faster if I used addrange but I can't figure out the conversion. This compiles but blows up at runtime.
Code:
lviVar.SubItems.AddRange(DirectCast(drDef(0)("desc"), String()))