ComponentOne VSFlexGrid 8.0
GetSelection Method

Returns the current selection ordered so that Row1 <= Row2 and Col1 <= Col2.

Syntax

[form!]VSFlexGrid.GetSelection Row1 As Long, Col1 As Long, Row2 As Long, Col2 As Long

Remarks

When programming the VSFlexGrid control, a common task is looping through the currently selected range to perform some action on the selected cells, defined by the values of the Row, RowSel, Col, and ColSel properties. When setting up such loops, you should take into account the fact that Row may be greater than or smaller than RowSel, and Col may be greater than or smaller than ColSel. Instead of comparing these values to set up the loop bounds, use the GetSelection to obtain the loop bounds in the proper order.

For example, the code below prints the contents of the selected range:

    Dim r&, c&, r1&, c1, r2&, c2&

    fg.GetSelection r1, c1, r2, c2

    For r = r1 To r2

        For c = c1 To c2

            Debug.Print fg.TextMatrix

        Next

    Next

 

 


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

Product Support Forum  |  Documentation Feedback