Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleDisplay a matrix in a FlexGrid control
KeywordsFlexGrid, matrix
CategoriesControls
 
Use the Rows and Cols properties to size the grid. Use TextMatrix to set the values in the grid.
 
Private Sub Form_Load()
Dim matrix(1 To 4, 1 To 2) As Single
Dim r As Integer
Dim c As Integer

    For r = 1 To UBound(matrix, 1)
        For c = 1 To UBound(matrix, 2)
            matrix(r, c) = Rnd * 100
        Next c
    Next r

    MSFlexGrid1.Rows = UBound(matrix, 1)
    MSFlexGrid1.Cols = UBound(matrix, 2)
    MSFlexGrid1.FixedCols = 0
    MSFlexGrid1.FixedRows = 0
    For r = 1 To UBound(matrix, 1)
        For c = 1 To UBound(matrix, 2)
            MSFlexGrid1.TextMatrix(r - 1, c - 1) = _
                Format$(matrix(r, c), "0.00")
        Next c
    Next r
End Sub
 
Formatted by Neil Crosby
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated