Share via


Visual Basic Concepts

Using the Microsoft Hierarchical FlexGrid Control

The Microsoft Hierarchical FlexGrid (MSHFlexGrid) and Microsoft FlexGrid (MSFlexGrid) controls present Recordset data, from one or more tables, in a grid format.

The Hierarchical FlexGrid control provides you with advanced features for displaying data in a grid. It is similar to the Microsoft Data Bound grid (DataGrid) control, but with the distinct difference that the Hierarchical FlexGrid control does not allow the user to edit data bound to, or contained within, it. This control, therefore, allows you to display data to the user while ensuring that the original data remains secure and unchanged. It is also possible, however, to add cell-editing features to your Hierarchical FlexGrid control by combining it with a text box.

While the Hierarchical FlexGrid control is based on the FlexGrid control used in Visual Basic 5.0, the Hierarchical FlexGrid control is the more flexible of the two. The Hierarchical FlexGrid control also provides more display options with which you can define a custom format that best suits your needs.

These topics primarily focus on using the Hierarchical FlexGrid. For information on the former FlexGrid control, see your Visual Basic 5.0 documentation.

Visual Basic's FlexGrid controls

Icon Abbreviation Control Name
MSHFlexGrid control Microsoft Hierarchical FlexGrid control
MSFlexGrid control Microsoft FlexGrid control

The Hierarchical FlexGrid control supports the following features:

  • Read-only data binding.

  • Dynamic rearrangement of columns and rows.

  • Automatic regrouping of data during column adjustment.

  • Adaptation to existing Visual Basic code for the DBGrid control.

  • Each cell may contain text, a picture, or both.

  • Changing current cell text in code or at .

  • Reading data automatically when the Hierarchical FlexGrid is assigned to a data control.

  • Wordwrap for text within cells.

  • ActiveX® Data Binding when the DataSource and DataMember properties of the control are bound to a specific data provider. *

  • Binding directly to grouped and related ADO Recordsets from a Command hierarchy. *

  • Additional display options when the Hierarchical FlexGrid is bound to a hierarchy of Recordsets. These additional options enable a diverse display for grouped and related Recordsets, including bands. *

Note   To take advantage of the features marked with this symbol (*) you must use the Hierarchical FlexGrid control. These features are not available in the FlexGrid control.

Due to limitations of the previous FlexGrid control, some features, such as bands, are not accessible using this control. To have access to all features, we recommend that you use the Hierarchical FlexGrid control when creating a new data-bound grid control. The FlexGrid control does not automatically update to the Hierarchical FlexGrid control.

Accessing the Hierarchical FlexGrid Control

Use the following procedure to install and access the Hierarchical FlexGrid control in Visual Basic.

To install and access the Hierarchical FlexGrid control

  1. On the Project menu, select Components. The Components dialog box appears.

  2. On the Controls tab, select Microsoft Hierarchical FlexGrid Control 6.0, and then click OK. The MSHFlexGrid control is added to the Visual Basic toolbox.

  3. On the Visual Basic toolbox, click the MSHFlexGrid control, and then drop it on a Visual Basic .

    -or-

    On the Visual Basic toolbox, double-click the MSHFlexGrid control to add it to a form.