windowsforms-devexpress-dot-xtraeditors-dot-controls-dot-lookupcolumninfocollection-dot-add-x28-devexpress-dot-xtraeditors-dot-controls-dot-lookupcolumninfo-x29.md
Adds a new column to the current collection.
Namespace : DevExpress.XtraEditors.Controls
Assembly : DevExpress.XtraEditors.v25.2.dll
NuGet Package : DevExpress.Win.Navigation
public virtual int Add(
LookUpColumnInfo column
)
Public Overridable Function Add(
column As LookUpColumnInfo
) As Integer
| Name | Type | Description |
|---|---|---|
| column | LookUpColumnInfo |
A column to add to the collection.
|
| Type | Description |
|---|---|
| Int32 |
The position into which the new element was inserted.
|
Use the Add method to add a new element to the collection. The column to add is passed as the column parameter. To add several columns at once, see the LookUpColumnInfoCollection.AddRange method.
The following code adds two columns to the RepositoryItemLookUpEdit.Columns collection of a lookup editor. For each column we initialize its field, caption and width.
using DevExpress.XtraEditors.Controls;
//...
lookUpEdit1.Properties.Columns.Add(new LookUpColumnInfo("ID", "No", 20));
lookUpEdit1.Properties.Columns.Add(new LookUpColumnInfo("Name", "Customer Name", 80));
Imports DevExpress.XtraEditors.Controls
' ...
LookUpEdit1.Properties.Columns.Add(New LookUpColumnInfo("ID", "No", 20))
LookUpEdit1.Properties.Columns.Add(New LookUpColumnInfo("Name", "Customer Name", 80))
The following code snippets (auto-collected from DevExpress Examples) contain references to the Add(LookUpColumnInfo) 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-lookup-show-custom-tooltips/CS/LookUpEditWithHints/Form1.cs#L31
LookUpColumnInfoCollection coll = lookUpEditHints1.Properties.Columns;
coll.Add(new LookUpColumnInfo("Customer"));
coll.Add(new LookUpColumnInfo("Description"));
this.lookUpEdit1.Properties.Columns.Clear();
this.lookUpEdit1.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("Summary"));
this.lookUpEdit1.EditValue = CalendarId;
winforms-lookup-show-custom-tooltips/VB/LookUpEditWithHints/Form1.vb#L26
Dim coll As LookUpColumnInfoCollection = lookUpEditHints1.Properties.Columns
coll.Add(New LookUpColumnInfo("Customer"))
coll.Add(New LookUpColumnInfo("Description"))
Me.lookUpEdit1.Properties.Columns.Clear()
Me.lookUpEdit1.Properties.Columns.Add(New DevExpress.XtraEditors.Controls.LookUpColumnInfo("Summary"))
Me.lookUpEdit1.EditValue = CalendarId
See Also
LookUpColumnInfoCollection Class