This topic demonstrates how to use the GroupIntervalEnum.Alphabetical member in C1TrueDBGrid.
Complete the following steps:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Me.ProductsTableAdapter.Fill(Me.Products._Products) |
To write code in C#
C# |
Copy Code
|
---|---|
this.productsTableAdapter.Fill(this.Products._Products); |
In the Designer
In the C1TrueDBGrid Tasks menu, select GroupBy from the Data Layout drop-down.
In Code
Add the following code to the Form_Load event:
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; |
The column can also be selected by choosing ProductName from the drop-down list in the toolbar.
In the Designer
Locate the Interval property in the left pane of the C1TrueDBGrid Designer and set it to Alphabetical.
In Code
Add the following code to the Form_Load event:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
' Set the GroupInfo.Interval of the ProductName column to Alphabetical. Me.C1TrueDBGrid1.Columns("ProductName").GroupInfo.Interval = C1.Win.C1TrueDBGrid.GroupIntervalEnum.Alphabetical |
To write code in C#
C# |
Copy Code
|
---|---|
// Set the GroupInfo.Interval of the ProductName column to Alphabetical. this.c1TrueDBGrid1.Columns["ProductName"].GroupInfo.Interval = C1.Win.C1TrueDBGrid.GroupIntervalEnum.Alphabetical; |
In the Designer
Locate the ColumnVisible property in the left pane of the C1TrueDBGrid Designer and set it to True.
In Code
Add the following code to the Form_Load event:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
' Keep the ProductName column visible while grouping. Me.C1TrueDBGrid1.Columns("ProductName").GroupInfo.ColumnVisible = True |
To write code in C#
C# |
Copy Code
|
---|---|
// Keep the ProductName column visible while grouping. this.c1TrueDBGrid1.Columns["ProductName"].GroupInfo.ColumnVisible = true; |
In this example, the ProductName column is grouped by the first letter of the product name.