To change the column order in the grid, use the C1TrueDBGrid Designer or set RemoveAt and Insert methods in code.
In the Designer
1. Open the TrueDBGrid Designer. For information on how to access the TrueDBGrid Designer, see Accessing the TrueDBGrid Designer.
2. In the designer, select the Country column from the right pane.
3. Click and drag the Country column to the left. A red arrow will appear where the column can be dropped.
4. Drop the Country column before the First column.
5. Click OK to close the designer.
In Code
1. Declare the variable for the Country column by adding the following code to the Form_Load event:
Dim dispColumn As C1.Win.C1TrueDBGrid.C1DisplayColumn
dispColumn = Me.C1TrueDBGrid1.Splits(0).DisplayColumns(2)
· C#
C1.Win.C1TrueDBGrid.C1DisplayColumn dispColumn;
dispColumn = this.c1TrueDBGrid.Splits[0].DisplayColumns[2];
· Delphi
var
dispColumn : C1.Win.C1TrueDBGrid.DisplayColumn;
begin
dispColumn := Self.c1TrueDBGrid.Splits[0].DisplayColumns[2];
2. Move the Country column before the First column:
Me.C1TrueDBGrid1.Splits(0).DisplayColumns.RemoveAt(2)
Me.C1TrueDBGrid1.Splits(0).DisplayColumns.Insert(0, dispColumn)
· C#
this.c1TrueDBGrid1.Splits[0].DisplayColumns.RemoveAt(2);
this.c1TrueDBGrid1.Splits[0].DisplayColumns.Insert(0, dispColumn);
· Delphi
Self.C1TrueDBGrid1.Splits[0].DisplayColumns.RemoveAt(2);
Self.C1TrueDBGrid1.Splits[0].DisplayColumns.Insert(0, dispColumn);
This topic illustrates the following:
The Country column appears in the grid before the First column.
Send comments about this topic to ComponentOne. Copyright © ComponentOne LLC. All rights reserved. |