Condividi tramite


Column Object

Creates a Column object in a Grid control. A grid column can contain data from a field in a table or the value of an expression. A column can also contain controls.

Grid.Column

Remarks

To specify the data appearing in the column, use the column's DataSource property.

You can specify the number of columns in a grid with the grid's ColumnCount property.

You can add controls to a column in a grid by using the AddObject method in the Init event of the form that contains the grid. To set the active control in the grid's column, use the column's CurrentControl property. To specify the source of the control's data, set the control's ControlSource property.

Note   You cannot access headers and controls for a column until the Init event for the grid occurs.

For additional information about creating columns in a grid, see Grid Control and Using Controls.

Hiding Columns   To hide a column in a grid, set the Visible property for the column to False (.F.). You can still set the Value property of any control in the column. For example, you can still change the value of Column.Text1.Value by specifying a new value, even when the column is hidden.

Visual FoxPro processes uncommitted changes in a hidden column as usual and at the appropriate time according to BufferMode property of the form. For example, hiding a column does not cause nor prevent pending updates from being committed to that column.

When you hide a column that has focus, focus does not automatically move from the hidden column to the next or previous column. In essence, no column has focus. If you want to move focus to another cell, column, or control, you must manually move the focus, for example, by pressing the TAB key or using the mouse.

When you hide all columns in a grid, only the record-pointer portion of the grid along the left side remains visible.

Setting the AllowAutoColumnFit property and using the AutoFit method does not affect hidden columns. For more information, see AllowAutoColumnFit Property and AutoFit Method.

See Also

Column Object Properties, Methods and Events | CREATE CLASS | CREATE FORM | DEFINE CLASS | Header Object