ComponentOne True DBGrid for WinForms
Data Presentation Techniques / Filtering Data in DataSets / Filtering the Grid with Multiple Criteria
In This Topic
    Filtering the Grid with Multiple Criteria
    In This Topic

    You can now easily filter the grid with multiple filter criteria at run time. For example, you can filter the grid so that only items starting with the letter A or the letter B appear in the grid (instead of limiting the filter to one or the other). All you need to do to have text appear in the filter bar is set the FilterMultiSelect property to True.

    For example in the following code, the FilterMultiSelect property in the first filter bar cell is set to True:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    ' Display the filter bar.
    Me.C1TrueDBGrid1.FilterBar = True
    ' Allow the first column to be filtered by multiple items.
    Me.C1TrueDBGrid1.Columns(0).FilterMultiSelect = True
    

    To write code in C#

    C#
    Copy Code
    // Display the filter bar.
    this.c1TrueDBGrid1.FilterBar = true; 
    // Allow the first column to be filtered by multiple items.
    this.c1TrueDBGrid1.Columns[0].FilterMultiSelect = true;
    

    If you run the application, you'll notice that you can filter the first cell with multiple criteria. For example type "a,b" in the filter bar and notice that items starting with the letter A and the letter B are displayed. You can customize the character used for separating filter items by setting the FilterSeparator property.

    See Also