Partager via


ColumnCount Property

Specifies the number of Column objects in a Grid, ComboBox, or ListBox control. For a grid, available at design time and read/write at run time. For a combo box or list box, available at design time and run time.

Object.ColumnCount[ = nCol]

Property Values

  • nCol
    For a Grid control, specifies the number of columns to display. The default is –1, which specifies that the Grid control should contain enough columns to accommodate all the fields in the grid's record source. The maximum number of columns is 255. If you create a specific number of columns by setting nCol to a positive value, specify the data to display in a particular column by setting that column's ControlSource property. (If ControlSource is not specified for a column, the Grid control displays the next available undisplayed field of the grid's record source.)

    For a ComboBox or ListBox control, nCol specifies the number of columns the control contains. If you set ColumnCount to 0, the first column is displayed based on the RowSource property or on the items added with the AddItem method.

Remarks

For a grid, use the AddColumn method to increase the number of columns.

See Also

AddColumn Method | ColumnOrder Property | Order Property

Applies To: ComboBox Control | Grid Control | ListBox Control