DataGrid Column Object

A DataGrid column object represents an individual column in the Columns collection of the DataGrid control.

Client support

   Newlook Smartclient

   Newlook Server

Use

When a subfile is received from the IBM i, the recognition engine attempts to organize its data into columns. These columns are represented by the columns collection.

If columns are clearly identified in the subfile, then the ShowColumns property defaults to True and column separators are displayed in the GUI. When the recognition engine encounters ambiguities in column recognition, then the ShowColumns property defaults to False, columns are not displayed and the Columns Editor is disabled in Designer. Column information is still stored in the Columns collection however and it is possible to force the data into columns by setting the ShowColumns property to True, either in Designer, or via a script or macro. When column recognition is forced on, the recognition engine inserts blank cells, where necessary, in order to organize the data into logical columns and maintain grid headings.

When a data grid control has columns enabled, there may be a difference between the total number of identified columns, which can be returned by the App.ActiveForm.grid.Columns.Count property, and the total number of columns displayed in the GUI. This is because the recognition engine hides certain columns that it identifies as non-data or 'padding' columns. By default, these columns have their Visible property set to False.

For this reason it is important to use the Columns.Count property to determine the total number of columns in a subfile before creating any code that references specific columns or contains looping structures. (Refer to the ColCounts collection topic for information on looping through cells in non-column grids).

The following column properties are available for grids that have ShowColumns enabled. They can be set via the Columns Editor in Designer or dynamically at runtime via a script or macro. For more information about modifying column properties refer to the Columns property topic.

Applies To

DataGrid Control

See Also

ColumnHeaders object | Cell object | DataGrid control