Back to Devexpress

GridColumnCollection.Add(GridColumn) Method

windowsforms-devexpress-dot-xtragrid-dot-columns-dot-gridcolumncollection-dot-add-x28-devexpress-dot-xtragrid-dot-columns-dot-gridcolumn-x29.md

latest4.3 KB
Original Source

GridColumnCollection.Add(GridColumn) Method

Adds the specified column to the end of the collection.

Namespace : DevExpress.XtraGrid.Columns

Assembly : DevExpress.XtraGrid.v25.2.dll

NuGet Packages : DevExpress.Win.Grid, DevExpress.Win.Navigation

Declaration

csharp
public virtual int Add(
    GridColumn column
)
vb
Public Overridable Function Add(
    column As GridColumn
) As Integer

Parameters

NameTypeDescription
columnGridColumn

The column to add to the collection.

|

Returns

TypeDescription
Int32

An integer value that specifies the position of the column within the collection.

|

The following code snippets (auto-collected from DevExpress Examples) contain references to the Add(GridColumn) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-grid-tokenedit-in-unbound-column/CS/Form1.cs#L57

csharp
col.OptionsColumn.AllowEdit = true;
gridView.Columns.Add(col);
gridView.CustomUnboundColumnData += OnGridViewCustomUnboundColumnData;

winforms-grid-add-radio-group-column/CS/Helper/GridRadioGroupColumnHelper.cs#L86

csharp
RadioGroupColumn.FieldName = "RadioGroupColumn";
_GridView.Columns.Add(RadioGroupColumn);
RadioGroupColumn.Visible = true;

winforms-grid-tokenedit-in-unbound-column/VB/Form1.vb#L54

vb
col.OptionsColumn.AllowEdit = True
gridView.Columns.Add(col)
AddHandler gridView.CustomUnboundColumnData, AddressOf OnGridViewCustomUnboundColumnData

winforms-grid-display-icons-in-data-cells/VB/Form1.vb#L193

vb
gridControl1.RepositoryItems.Add(buttonEdit)
gridView1.Columns.Add(New GridColumn() With {.Caption = "Unbound Column", .FieldName = "UnboundColumn", .UnboundDataType = GetType(Object), .Visible = True})
Dim pictureEditUnbound As RepositoryItemPictureEdit = TryCast(gridControl1.RepositoryItems.Add("PictureEdit"), RepositoryItemPictureEdit)

winforms-grid-add-radio-group-column/VB/Helper/GridRadioGroupColumnHelper.vb#L87

vb
RadioGroupColumn.FieldName = "RadioGroupColumn"
_GridView.Columns.Add(RadioGroupColumn)
RadioGroupColumn.Visible = True

See Also

Item

Grid Columns

GridColumnCollection Class

GridColumnCollection Members

DevExpress.XtraGrid.Columns Namespace