This documentation is archived and is not being maintained.

Visual Basic: MSFlexGrid/MSHFlexGrid Controls

Visual Studio 6.0

FormatString Property

See Also    Example    Applies To

Sets the column widths, alignments, fixed row text, and fixed column text of the MSHFlexGrid.


object.FormatString [= string]

The FormatString property syntax has these parts:

Part Description
object An object expression that evaluates to an object in the Applies To list.
string A string expression for formatting text in rows and columns, as described in Remarks.


At design time, the MSHFlexGrid parses and interprets the FormatString to obtain the following information: number of rows and columns, text for row and column headings, column width, and column alignment.

The FormatString property contains segments separated by pipe characters (|). The text between pipes defines a column and may also contain special alignment characters. These characters align the entire column to the left (<), center (^), or right (>). In addition, the text is assigned to row zero by default, and the text width defines the width of each column.

The FormatString property may contain a semicolon (;). This causes the remainder of the string to be interpreted as row heading and row width information. In addition, the text is assigned to column zero by default, and the longest string defines the width of column zero.

The MSHFlexGrid creates additional rows and columns to accommodate all fields defined by the FormatString. Additional rows and columns are not deleted if only a few fields are specified. To remove additional rows and columns, set the Rows and Cols properties.