Skip to content

Add Method

Description

Adds a GridColumn to the collection of sorted and/or grouped columns.

Syntax

Public Sub Add( _
    ByVal [Column] As [GridColumn](XtremeGridControl~GridColumn.md) _
)

Parameters

Remarks

This method is used to add columns to the collection of sorted and/or grouped columns, which determine how the columns are sorted and grouped within the GridControl and Group Box. It adds a new column to the end of the collection, growing the collection by 1.

GridControl SortOrder

The Add method is used to add columns to the GridControl's SortOrder collection of sorted columns. Columns added to the SortOrder collection determine how the columns in the GridControl are sorted. The columns in the GridControl are first sorted by the column at index zero (0) in the SortOrder collection, then they are sorted by the column at index one (1), etc.

Group Box

The Add method is used to add columns to the GridControl's GroupOrder collection of sorted columns. Columns added to the GroupOrder collection determine how the columns in the GridControl are grouped/sorted. The columns in the GridControl are first grouped/sorted by the column at index zero (0) in the GroupOrder collection, then they are grouped/sorted by the column at index one (1), etc.

Example

Sorting columns in the GridControl (Visual Basic): This sample illustrates how to sort the columns in the GridControl. If you had 8 columns added to the GridControl, this sample would sort the columns first by the column at ItemIndex 7, then by the column at ItemIndex 2, then by the column at ItemIndex 5.

' This code below will add three columns to the SortOrder collection of columns.  
' This will cause the columns in the GridControl to first be sorted by column 7,  
' which has an index of zero (0) in the SortOrder collection. Columns are first sorted  
' in the order that they are added to the SortOrder collection.  

wndGridControl.SortOrder.Add wndGridControl.Columns(7)  
wndGridControl.SortOrder.Add wndGridControl.Columns(2)  
wndGridControl.SortOrder.Add wndGridControl.Columns(5)  

' This will cause the column at index 1 of the SortOrder collection to be sorted  
' in descending order.  

wndGridControl.SortOrder(1).SortAscending = False  

' Any time you add or delete columns to the SortOrder or GroupOrder collections,  
' the Populate method must be called to show the changes in the GridControl's view.  

wndGridControl.Populate  

See Also


Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.