AddEx Method
Description
Adds a GridColumn to the collection of columns using a unique identifier.
Syntax
Public Function AddEx( _
ByVal [ItemIndex](#) As Integer, _
ByVal [Caption](#) As String, _
ByVal [InternalName](#) 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.
- InternalName: Internal column name which is used in serialization to uniquely identify the column rather than the column index.
- 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.
The InternalName (Internal column name) is used as a unique column identifier when serializing column data. If it is empty (as it is for previous versions), the column index is used as such an identifier. However, using the index is not appropriate when the column data is saved and then some columns are added, deleted, or reordered. If you read old data using a new columns collection, you will get incorrect results. If the InternalName is set, the column data read will be applied to the column with such a name or skipped if no such column exists in the collection. Additionally, the new columns will keep the default/current properties instead of applying properties read from the old column with the same index.
Example
AddEx Sample (Visual Basic)
This sample illustrates how to add a column to the GridControl's collection of columns using AddEx.
' 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.AddEx(COLUMN_NAME, "Name", "NameColumn", 300, False)
See Also
Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.