I have a datagrid on my application getting it's data from a database. Which is working through putting it in to a datatable and then showing it using dataGrid1.ItemsSource = DT.DefaultView.
I also have a textbox which is going to be used as a search box. Im wanting the search box to search through the datagrid and show the correct data. show not just higlight but actually make the data disappear or reappear based on the user input in to the search box.
I have search through multiple forums but non of the solutions I found worked on my application. So if anyone could give me a solution i would be very grateful.
EDIT, Sorted the problem
Private Sub txtSearchBox_TextChanged(ByVal sender As System.Object, ByVal e As System.Windows.Controls.TextChangedEventArgs) Handles txtSearchBox.TextChanged
If txtSearchBox.Text = "" Then
dataGrid1.ItemsSource = DT.DefaultView 'puts the data in to the datagrid
DT.DefaultView.RowFilter = Nothing
Else
chosenFilter = txtSearchBox.Text
'sets the datagrid filter
DT.DefaultView.RowFilter = "TYPEID LIKE '%" & chosenFilter & "%'"
End If
End Sub