Adds a new column to the Columns collection, a new bookmark to the SelBookmarks collection, or a new split to the Splits collection of the DataGrid control. Doesn't support named arguments.
Syntax
object.Add colindex
object.Add bookmark
The Add method syntax has these parts:
Part | Description |
object | An object expression that evaluates to an object in the Applies To list. |
colindex | Required. An integer that specifies where the new Column or Split object is inserted in the Columns collection or Splits collection, as described in Settings. |
bookmark | The bookmark to be added to the collection. |
Settings
The settings for colindex are:
Setting | Description |
0 | Inserts new column as leftmost column. |
Count | If the colindex argument is the same as the Count property setting, the new column is inserted as the rightmost column. |
n | Inserts the new column to the left of the nth column in the Columns collection. The nth column and all subsequent columns are incremented accordingly. |
Remarks
The Add method inserts a new Column object into the Columns collection based on the colindex argument. New columns are added with their Visible property set to False and all other properties set to their default values. Initially, new columns are unbound because the DataField property is set to a zero-length string (""). The Count property of the Columns collection is incremented to reflect the new column.
Important If you have previously deleted a column using the Remove method, after adding new columns, you may need to refresh the display with the Rebind and Refresh methods. This instructs the DataGrid control to rebuild its internal column layout matrix to correctly reflect the true status of the control.
Use the Add method to add bookmarks to the SelBookmarks collection. Once a bookmark is appended to the SelBookmarks collection, it appears selected in the DataGrid control.