windowsforms-3061-controls-and-libraries-data-grid-examples-data-editing-how-to-create-a-column-and-assign-an-editor-to-it.md
The following example demonstrates how to create a column within a View, and assign a specific editor to it.
using DevExpress.XtraGrid.Views.BandedGrid;
using DevExpress.XtraEditors.Repository;
//...
// Create a column
BandedGridColumn col = advBandedGridView1.Columns.Add("Country") as BandedGridColumn;
// Add a column to the first Band
advBandedGridView1.Bands[0].Columns.Add(col);
// Show the new column
col.Visible = true;
// Create a Repository Item
RepositoryItemLookUpEdit columnEditor = new RepositoryItemLookUpEdit();
// Customize the editor
//...
// Add the new Repository Item to the "RepositoryItems" collection
gridControl1.RepositoryItems.Add(columnEditor);
// Assign the editor to the new column
col.ColumnEdit = columnEditor;
Imports DevExpress.XtraGrid.Views.BandedGrid
Imports DevExpress.XtraEditors.Repository
'...
' Create a column
Dim col As BandedGridColumn = TryCast(advBandedGridView1.Columns.Add("Country"), BandedGridColumn)
' Add a column to the first Band
advBandedGridView1.Bands(0).Columns.Add(col)
' Show the new column
col.Visible = True
' Create a Repository Item
Dim columnEditor As New RepositoryItemLookUpEdit()
' Customize the editor
'...
' Add the new Repository Item to the "RepositoryItems" collection
gridControl1.RepositoryItems.Add(columnEditor)
' Assign the editor to the new column
col.ColumnEdit = columnEditor
See the Cell Values, Editors, and Validation topic for more information about column editors.