ComponentOne True DBGrid for .NET (2.0) Search HelpCentral 

Tutorial 21 - Filter Bar

In this tutorial, you will learn how to use the grid’s Filter Bar functionality to allow the end user to sort column data dynamically at run time.

1.   Start with the project created in Tutorial 1 - Binding True DBGrid to a DataSet.

2.   After the existing code in the Load event of Form1 add the following line:

·      Visual Basic

Me.C1TrueDBGrid1.FilterBar = True

·      C#

this.C1TrueDBGrid1.FilterBar = true;

·      Delphi

Self.C1TrueDBGrid1.FilterBar := True;

Run the program and observe the following:

·      C1TrueDBGrid1 displays the data specified in Tutorial 1 - Binding True DBGrid to a DataSet.

·      Above the grid data is now a line that accepts user input. This is the Filter Bar. When a user enters data into the bar the grid automatically filters the column data.

Before Filter:

After Filter:

·      If you would prefer to handle the filtering yourself, then you would have to change the AllowFilter property to False (keeping FilterBar equal to True). Then you would have to handle the FilterChange event which fires each time the state of the Filter Bar changes.

This concludes the tutorial.


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.