Help Center

CountColumnsInBandfunction

Returns the number of columns within a specific logical group or band.

Windowsfunctiondoc-orphan
No implementation located. This member is documented, but the source scan found no matching declaration. It is likely declared in a header this scan does not resolve, or provided by a macro.

Syntax

FUNCTION CountColumnsInBand (BYVAL BandNumber AS LONG) AS LONG

Parameters

NameDescription
BandNumberThe zero‑based index of the band whose column count you want to retrieve.

Description

Returns the number of columns of the specified band.

Remarks

CountColumnsInBand returns the number of columns defined within a specific band of a hierarchical grid. This is especially useful when working with shaped Recordsets, where each band may have a different number of fields.

Typical uses include:

  • iterating through all columns of a specific band
  • applying formatting (e.g., ColWidth, ColAlignment) only to columns belonging to that band
  • dynamically generating headers or layouts based on the band structure
  • debugging shaped Recordsets to verify the expected number of fields per band

Example

Dim cols As Long = grid.CountColumnsInBand(1) Print "Band 1 has "; cols; " columns."

Reference