# .NET and More > WPF, WCF, WF >  Filtering a datagrid with textbox text

## oozzoo

Back in the day "vb6"  it was simple to filter a datagrid with the following code.

_____________________________________________________
Private Sub Text1_Change()
    If Text1 = "" Then
        Adodc1.Recordset.Filter = ""
    Else
        Adodc1.Recordset.Filter = "[LastName] Like '*" & Text1 & "*'"
    End If
End Sub
_____________________________________________________

This would collaps the grid the more specific one got

How Is this done in vb.net 2010 I cant figure it out

Thank you

----------

