windowsforms-devexpress-dot-xtragrid-dot-columns-dot-gridcolumncollection-dot-addfield-x28-system-dot-string-x29.md
Creates a new hidden column which is bound to the specified field, and appends it to the collection.
Namespace : DevExpress.XtraGrid.Columns
Assembly : DevExpress.XtraGrid.v25.2.dll
NuGet Packages : DevExpress.Win.Grid, DevExpress.Win.Navigation
public virtual GridColumn AddField(
string fieldName
)
Public Overridable Function AddField(
fieldName As String
) As GridColumn
| Name | Type | Description |
|---|---|---|
| fieldName | String |
A String value that specifies the name of the data field to which to bind the created column.
|
| Type | Description |
|---|---|
| GridColumn |
A GridColumn object which represents the new column.
|
Use the GridColumn.VisibleIndex property to control the column’s visibility.
The following code snippets (auto-collected from DevExpress Examples) contain references to the AddField(String) 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.
lookUpLabelProduct.Properties.View.OptionsView.ShowIndicator = false;
GridColumn col1 = lookUpLabelProduct.Properties.View.Columns.AddField("Name");
col1.VisibleIndex = 0;
winforms-grid-use-layoutview-as-master-view/CS/WindowsApplication3/MasterDetailHelper.cs#L85
private GridColumn CreateColumn() {
GridColumn column = view.Columns.AddField("Detail");
column.Visible = true;
winforms-grid-use-coloredit-to-edit-unbound-column-string-values/CS/ColorEditExample/Form1.cs#L31
GridColumn unboundColumn = gridView1.Columns.AddField("Color");
unboundColumn.VisibleIndex = gridView1.Columns.Count;
gridControl1.ForceInitialize();
GridColumn col = gridView1.Columns.AddField("Tasks");
col.UnboundType = DevExpress.Data.UnboundColumnType.Integer;
lookUpLabelProduct.Properties.View.OptionsView.ShowIndicator = False
Dim col1 As GridColumn = lookUpLabelProduct.Properties.View.Columns.AddField("Name")
col1.VisibleIndex = 0
winforms-grid-use-layoutview-as-master-view/VB/WindowsApplication3/MasterDetailHelper.vb#L95
Private Function CreateColumn() As GridColumn
Dim column As GridColumn = view.Columns.AddField("Detail")
column.Visible = True
winforms-grid-use-coloredit-to-edit-unbound-column-string-values/VB/ColorEditExample/Form1.vb#L24
gridView1.Columns("ColorString").Visible = False
Dim unboundColumn As GridColumn = gridView1.Columns.AddField("Color")
unboundColumn.VisibleIndex = gridView1.Columns.Count
gridControl1.ForceInitialize()
Dim col As GridColumn = gridView1.Columns.AddField("Tasks")
col.UnboundType = DevExpress.Data.UnboundColumnType.Integer
See Also