hi ol,

i m developing a sotware where i wanna filter a column in data grid with multiple string values. eg: column1 should display string1 value or string2 value or both.. im putting those stings in a list box and when i click a button those listed values should be filterd... please help me to figure this out. any one.......

thnk you!

7 Years
Discussion Span
Last Post by TomW

You can set the datatable to DefaultView and then use the RowFilter method, to only show the records that meet your filter critera. There is a general example below:

Sub ListBox1_SelectedIndexChanged

    If m_blnLoading = True Then Exit Sub

    With MyDataSet.MyTable.DefaultView
        Select Case FilterCritera
            Case Critera1
                .RowFilter = "Column1 = 0"
            Case Critera2
                .RowFilter = "Column1 = 1"
            Case Else
                .RowFilter = "Column1 = 3"
        End Select
    End With

End Sub

Edited by TomW: n/a


TomW thank you for your reply!

Actually when i click a button clolumn 1 should be filtered with values or strings in the list box. All the strings should be used to filter!

Thank you!


The example shows how you can filter data in a datatable, obviously you have to replace the values with the appropiate column names and search values you want.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.