Clear Method

Clears the contents of the control. Optional parameters specify what to clear and where.

Syntax

[form!]VSFlexGrid.Clear [ Where As Variant ], [ What As Variant ]

Remarks

The parameters for the Clear method are described below:

Where As ClearWhereSettings (optional)

Defines what part of the grid will be cleared. Valid settings for this parameter are:

 

Constant

Value

Description

flexClearEverywhere

0

Clear everywhere (this is the default setting).

flexClearScrollable

1

Clear scrollable region (excludes fixed rows and columns).

flexClearSelection

2

Clear current selection.

 

What As ClearWhatSettings (optional)

Defines what part of the grid's information will be cleared. Valid settings for this parameter are:

 

Constant

Value

Description

FlexClearEverything

0

Clear cell text, formatting and custom data (this is the default setting).

FlexClearText

1

Clear text only.

FlexClearFormatting

2

Clear custom formatting only (including pictures and cell data).

FlexClearData

3

Clears all custom data (row, column, and cell data).

 

The Clear method does not affect the number of rows and columns on the grid, and cannot be used to clear data when the grid is bound data source.

You may clear the text or custom formatting in an arbitrary range using the Cell property. For example, the following code clears all text and custom formatting in a range:

    fg.Cell(flexcpText, r1, c1, r2, c2) = ""

    fg.Cell(flexcpCustomFormat, r1, c1, r2, c2) = False

This example clears the text of the selected cell(s) while leaving the picture and cell data intact:

    fg.Clear flexClearSelection, flexClearText

See Also

VSFlexGrid Control