Visual Basic
Visual Basic
The Microsoft FlexGrid (MSFlexGrid) control displays and operates on tabular data. It allows complete
flexibility to sort, merge, and format tables containing strings and pictures. When bound to a Data control,
MSFlexGrid displays read-only data.
Syntax
MSFlexGrid
Remarks
You can put text, a picture, or both, in any cell of an MSFlexGrid. The Row and Col properties specify the
current cell in an MSFlexGrid. You can specify the current cell in code, or the user can change it at run time
using the mouse or the arrow keys. The Text property references the contents of the current cell.
If the text in a cell is too long to display in the cell, and the WordWrap property is set to True, the text
wraps to the next line within the same cell. To display the wrapped text, you may need to increase the cells
column width (ColWidth property) or row height (RowHeight property).
Use the Cols and Rows properties to determine the number of columns and rows in an MSFlexGrid.
Note Before you can use an MSFlexGrid in your application, you must add the MSFlxGrd.ocx file to your
project. To automatically include the file in your project, put it in the Auto load file. When distributing your
application, you should install the MSFlxGrd.ocx file in the users Microsoft Windows System directory. For
more information about adding an ActiveX control to a project, see "Standard ActiveX Controls" in the
Visual Basic Programmers Guide.
Properties :
AllowBigSelection Property
Returns or sets a value that determines whether clicking on a column or row header should cause the entire
column or row to be selected.
Syntax
object.AllowBigSelection [=Boolean]
The AllowBigSelection property syntax has these parts:
Part Description
Boolea A Boolean expression that specifies whether an entire column or row is selected when the header
n is clicked.
Settings
The settings for Boolean are:
Setting Description
True Default. When the user clicks the header, the entire column or row is selected.
False When the user clicks the header, only the header is selected.
Example : The following code example allows an entire column or row to be selected when the user
clicks on the header.
Note If you are using the MSFlexGrid, substitute "MSHFlexGrid1" with "MSFlexGrid1."
Sub Form1_Load ()
MSHFlexGrid1.AllowBigSelection =True
End Sub
AllowUserResizing Property
Returns or sets a value that determines whether the user can use the mouse to resize rows and columns in
the MSHFlexGrid.
Syntax
object.AllowUserResizing [=value]
The AllowUserResizing property syntax has these parts:
Part Description
value An integer or constant that specifies whether a user can resize rows and columns, as described in
Settings.
Settings
The settings for value are:
flexResizeNone 0 None. Default. The user cannot resize with the mouse.
flexResizeColumns 1 Columns. The user can resize columns using the mouse.
flexResizeRows 2 Rows. The user can resize rows using the mouse.
flexResizeBoth 3 Both. The user can resize columns and rows using the mouse.
Remarks
To resize rows or columns, the mouse must be over the fixed area of the MSHFlexGrid and close to a
border between rows and columns. The mouse pointer changes into an appropriate sizing pointer, and the
user can drag the row or column to change the row height or column width.
Note If you are using the MSFlexGrid, substitute "MSHFlexGrid1" with "MSFlexGrid1."
Sub Form1_Load ()
MSHFlexGrid1.AllowUserResizing =True
End Sub