Skip to content

Add Method

Description

Adds a GridColumn to the collection of columns.

Syntax

Public Function Add( _
    ByVal [ItemIndex](#) As Integer, _
    ByVal [Caption](#) As String, _
    ByVal [Width](#) As Integer, _
    ByVal [Resizable](#) As Boolean _
) As [GridColumn](XtremeGridControl~GridColumn.md)

Parameters

  • ItemIndex: Index used to uniquely identify the column.
  • Caption: Text displayed in the column header.
  • Width: Initial width of the column.
  • Resizable: Specifies whether the column is Resizable and if AutoSize is enabled.

Remarks

Adds a new GridColumn to the collection, growing the collection by 1.

When GridRecordItems are added, only GridRecordItems that have an index that is the same as the GridColumn's ItemIndex will be displayed in that column.

Example

Adding a Column (Visual Basic): This sample illustrates how to add a Column to the GridControl's collection of columns.

' Add this to the General code section  
Const COLUMN_NAME = 1  

' This code is placed in the Form_Load event  
Dim Column As GridColumn  

' A new column with a Caption of "Name" is added  
Set Column = wndGridControl.Columns.Add(COLUMN_NAME, "Name", 300, False)  

See Also


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