BandLevelfunction
Returns the band number that contains the current cell. The band numbers begin at 0. The current cell is defined by the Col and Row properties.
Syntax
FUNCTION BandLevel () AS LONG
Description
Returns the zero-based band number that contains the current cell. The band numbers begin at 0. The current cell is determined by the Col and Row properties.
Remarks
It returns the band index (starting at 0) for the cell that currently has focus. For example, if you click a cell in the parent row, BandLevel might return 0; clicking a child record would return 1.
It is frequently used in conjunction with the BandColIndex property to format columns within a specific hierarchical level.
A common implementation is using BandLevel with the ColWidth property to adjust the width of columns belonging to a particular band rather than the entire grid.
To set the width of the first column in the second band (Band 1):
Examples
grid.BandLevel ' band number that contains the current cell
' Syntax: MSHFlexGrid.ColWidth(index, [bandlevel]) grid.ColWidth(0, 1) = 1500
Reference
- Documented in Windows/Windows GUI/MSHFlexGrid Class.md
- Topic: Microsoft Hierarchical Grid