AddColumn Method
Adds a Column object to a Grid control.
Grid.AddColumn(nIndex)
Parameters
- nIndex
Specifies a number representing the position in the grid where the new Column is added.
Remarks
When AddColum( ) is called, existing columns are moved to the right, and their ColumnOrder properties are incremented accordingly. The grid's ColumnCount property is also increased.
The grid's Controls property array is enlarged by one element, and a reference to the new column is placed in the new element. The new column is assigned a unique name.
For example, to add a new column and then assign a new name to that column, you could do the following.
THISFORM.Grid1.AddColumn(1) && Insert column at left.
THISFORM.Grid1.Columns(THISFORM.Grid1.ColumnCount).Name = "NewColumn"
THISFORM.Grid1.NewColumn.ControlSource = "Customer.CustID"
See Also
AddObject Method | ColumnCount Property | DeleteColumn Method
Applies To: Grid Control