Cols Property

Returns or sets the total number of columns in the control.

Syntax

[form!]VSFlexGrid.Cols[ = value As Long ]

Remarks

Use the Rows and Cols properties to get the dimensions of the control or to resize the control dynamically at run time.

The minimum number of rows and columns is 0. The maximum number is limited by the memory available on your computer. If the control runs out of memory while trying to add rows, columns, or cell contents, it will cause a run time error. To make sure your code works properly when dealing with large controls, you should add error-handling code to your programs.

If you increase the value of the Cols property, new columns are appended to the right of the grid. To insert columns at specific positions, you need to use the ColPosition property. If you decrease the value of the Cols property, the rightmost columns are removed from the control.

This example sets the number of columns in the grid to four:

   fg.Cols = 4

Data Type

Long

See Also

VSFlexGrid Control