ComponentOne True DBGrid for WinForms
Tutorial 17: Creating a Grouping Display
True DBGrid for WinForms Tutorials > Tutorial 17: Creating a Grouping Display

In this tutorial, you will learn how to use the DataView property to create a Grouping area above the grid, which enables the user to sort the data by columns at run time.

Complete the following steps:

  1. Start with the project created in Tutorial 1: Binding True DBGrid to a DataSet.
  2. Add the following code to the Load event of Form1 after the current DataAdapter code:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    Me.C1TrueDBGrid1.DataView = C1.Win.C1TrueDBGrid.DataViewEnum.GroupBy
    

    To write code in C#

    C#
    Copy Code
    this.c1TrueDBGrid1.DataView = C1.Win.C1TrueDBGrid.DataViewEnum.GroupBy;
    

Run the program and observe the following:

You've successfully completed creating a grouping area in the grid; this concludes the tutorial.