CodeItBetter Programming Another VB Programming Blog

How to Copy array data into a FlexGrid control

Posted on January 4, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
'Controls - How to Copy array data into a FlexGrid control
'The CopyArrayToGrid subroutine loops over the values in the array copying them
'into the FlexGrid control using its TextMatrix method.

Private Sub CopyArrayToGrid(ByRef m_ArrayData() As String, ByVal grd As MSFlexGrid)
    Dim intRowMin As Integer
    Dim intColMin As Integer
    Dim intRowMax As Integer
    Dim intColMax As Integer
    Dim intRow As Integer
    Dim intCol As Integer
 
    intRowMin = LBound(m_ArrayData, 1)
    intRowMax = UBound(m_ArrayData, 1)
    intColMin = LBound(m_ArrayData, 2)
    intColMax = UBound(m_ArrayData, 2)
    grd.Rows = intRowMax - intRowMin + 1
    grd.Cols = intColMax - intColMin + 1
    grd.FixedCols = 0
    grd.FixedRows = 0
 
    For intRow = intRowMin To intRowMax
        For intCol = intColMin To intColMax
            grd.TextMatrix(intRow - intRowMin, intCol - intColMin) = m_ArrayData(intRow, intCol)
        Next intCol
    Next intRow
End Sub
Filed under: Controls Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.