ComponentOne VSFlexGrid 8.0
Step 4: Cell Merging

The ability to dynamically merge cells is one of the features that sets the VSFlexGrid apart from other grid controls. Merging cells groups them visually, making the data easier to interpret.

To implement cell merging, we need only add two lines of code to the Form_Load event handler:

Example Title
Copy Code
    Private Sub Form_Load()

   

        ' initialize the control

        ' …

        ' define some sample data

        ' …

        ' populate the control with the data

        ' …

   

        ' set up cell merging (all columns)

        fg.MergeCells = flexMergeRestrictAll

        fg.MergeCol(-1) = True

   

        ' organize the data

        ' …

   

    End Sub

The new code sets the MergeCells property, which works over the entire control, then sets the MergeCol property to True for all columns (the -1 index may be used as a wildcard for all properties that apply to rows and columns).

Press F5 again to run the project. This time it looks very different from a typical grid. The cell merging makes groups of data stand out visually and help interpret the information.

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback