Visual Basic Concepts

Formatting a Band

In your Hierarchical FlexGrid you can use band formatting to specify the display options for a particular Recordset. A band is created for each Recordset in an ADO hierarchical Recordset. For example, when binding a Hierarchical FlexGrid to an ADO hierarchical Recordset that contains Customers and Orders, the Hierarchical FlexGrid initially contains two bands.

You can customize the appearance of your Hierarchical FlexGrid by formatting a band. This enables you to highlight important information among multiple bands. Band elements you can format include column headers, gridlines, colors, and indentation.

When binding to a non-hierarchical Recordset there is only one band, and this band is referred to as Band 0. No other bands are available, because bands are based on the Recordsets in the Command hierarchy.

Changing Band Layout

You can change the way that fields display within a band by changing the band's layout. By default, the fields display horizontally within bands, as in a standard grid.

Horizontal Band Display

Vertical display may cause the band to expand its height to accommodate all fields in the band. Any other bands that display in the Hierarchical FlexGrid also expand, ensuring that all bands are of equal height.

Vertical Band Display

To set band layout

  1. Right-click your Hierarchical FlexGrid, and then select Properties from the shortcut menu. The Hierarchical FlexGrid's Property Pages dialog box appears.

  2. On the General tab, set the BandDisplay.

  3. Click OK to apply the band's display properties to your Hierarchical FlexGrid and close the Property Pages dialog box.

Displaying Column Headers

When the band display is horizontal, you can set headers to display in your Hierarchical FlexGrid. The headers display directly above the band, repeating for each band in the Hierarchical FlexGrid. To display only one set of headers for each band, at the top or left of the Hierarchical FlexGrid, use fixed cells instead of headers. See "Customizing Fixed Appearance" (in the topic Customizing Areas of the Hierarchical FlexGrid) for information on fixed cells.

Horizontal Column Headers

  1. Right-click your Hierarchical FlexGrid, and then select Properties from the shortcut menu. The Hierarchical FlexGrid's Property Pages dialog box appears.

  2. On the Bands tab, select ColumnHeaders, and then select a column header style from the TextStyleHeader list box.

  3. Click OK to apply the column header properties to your Hierarchical FlexGrid and close the Property Pages dialog box.

Changing Column Order

You can change the order of columns within a band of your Hierarchical FlexGrid.

To change column order within a band

  1. Select the column that you want to move.

  2. Use the up and down arrows to move the column to a new position within the band.

Modifying Color and Gridlines

Band color and gridline information can be set globally or individually. You can modify color and gridlines to highlight important information within your Hierarchical FlexGrid and increase readability. In addition, you can specify whether to display gridlines between cells within a band. Use the following procedure to modify color and gridlines for all bands within your Hierarchical FlexGrid.

Note   To change color information for an individual band, you must programmatically perform the change using the BackColorBand property.

To globally modify color and gridlines

  1. Right-click your Hierarchical FlexGrid, and then select Properties from the shortcut menu. The Hierarchical FlexGrid's Property Pages dialog box appears.

  2. On the Bands tab, select a style from the Gridlines box, and then click Apply. This style determines the type of line drawn between the standard, text-filled, areas of your Hierarchical FlexGrid for the selected band.

  3. On the Style tab, select a style from GridLinesFixed. Next, select a style from GridLinesUnpopulated, and then click Apply. These styles determine the type of lines drawn between fixed and unpopulated areas of your Hierarchical FlexGrid.

  4. On the Color tab, assign each gridline property a color. To do this, first select a Color Set. Next, select the property to change (for example, GridColor), select a color from the Color Palette, and then click Apply. Repeat this for each of the Hierarchical FlexGrid gridlines that you wish to change.

    Note   When using Windows Default colors, the Hierarchical FlexGrid appears in the colors specified in the your Display Control Panel. In addition to changing the Hierarchical FlexGrid property's colors to a standard or Windows default color, you can create your own color definitions by clicking Edit Custom Color and using the resulting Color dialog box.

  5. Click OK to apply the gridline and color properties to your Hierarchical FlexGrid and close the Property Pages dialog box.

Indenting a Band

When displaying bands vertically, you can indent a band a specific number of columns. This enables you to clearly present bands of information to the user. The indented column before each band contains empty, non-working cells. Therefore, the user cannot place focus into these areas. The format characteristics of these cells are defined by the indent formatting properties, such as GridLinesIndent.

See the Vertical Band Display figure in Changing Band Layout, above.

To indent a band

  1. Right-click your Hierarchical FlexGrid, and then select Properties from the shortcut menu. The Hierarchical FlexGrid's Property Pages dialog box appears.

  2. On the Bands tab, select BandIndent and specify the number of columns by which to indent the band.

  3. Click OK to apply the band properties to your Hierarchical FlexGrid and close the Property Pages dialog box.

Using the Band Functionality with a Non-Hierarchical Recordset

You can format the band of a non-hierarchical Recordset using any of the properties in the Hierarchical FlexGrid's Property Pages dialog box.

A non-hierarchical Recordset contains only one band, Band 0. There are no other bands available because bands are based on the Recordsets in the Command hierarchy.