Results 1 to 2 of 2

Thread: Followup flexgrid

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2000
    Sudbury, Ontario ,Canada


    When I use the textMatrix property to
    return the value of all the rows in the
    column I can only get the first row to write
    to the degub window. Can you give me a short sample of what I am doing wrong

  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    San Jose, CA


    This is from MSDN Help. The TextMatrix property refers to the contents of a particular cell through its row and column values, and you need to iterate through those values to print them.

    Sort, TextMatrix Properties (MSHFlexGrid) Example
    The following example uses the Sort and TextMatrix properties. It performs an MSHFlexGrid sort according to the value of a ComboBox control. To use the example, place an MSHFlexGrid control and a ComboBox control on a form. Paste the following code into the Declarations section, and then press f5.

    Note If you are using the MSFlexGrid, substitute "MSHFlexGrid1" with "MSFlexGrid1."

    Private Sub Combo1_Click()
    ' Select Column according to Sort method.
    Select Case Combo1.ListIndex
    Case 0 To 2
    MSHFlexGrid1.Col =1
    Case 3 To 4
    MSHFlexGrid1.Col =2
    Case 4 To 8
    MSHFlexGrid1.Col =1
    End Select
    ' Sort according to Combo1.ListIndex.
    MSHFlexGrid1.Sort =Combo1.ListIndex
    End Sub
    Private Sub Form_Load()
    Dim i As Integer
    ' Fill MSHFlexGrid with random data.
    MSHFlexGrid1.Cols =3 ' Create three columns.

    For i =1 To 11 ' Add ten items.
    MSHFlexGrid1.AddItem ""
    MSHFlexGrid1.Col =2
    MSHFlexGrid1.TextMatrix(i, 1) =SomeName(i)
    MSHFlexGrid1.TextMatrix(i, 2) =Rnd()
    Next i
    ' Fill combo box with Sort choices
    With Combo1
    .AddItem "flexSortNone" ' 0
    .AddItem "flexSortGenericAscending" '1
    .AddItem "flexSortGenericDescending" '2
    .AddItem "flexSortNumericAscending" '3
    .AddItem "flexSortNumericDescending" '4
    .AddItem "flexSortStringNoCaseAsending" '5
    .AddItem "flexSortNoCaseDescending" '6
    .AddItem "flexSortStringAscending" '7
    .AddItem "flexSortStringDescending" '8
    .ListIndex =0
    End With
    End Sub
    Private Function SomeName(i As Integer) As String
    Select Case i
    Case 1
    SomeName ="Ann"
    Case 2
    SomeName ="Glenn"
    Case 3
    SomeName ="Sid"
    Case 4
    SomeName ="Anton"
    Case 5
    SomeName ="Hoagie"
    Case 6
    SomeName ="Traut 'Trane"
    Case 7
    SomeName ="MereD Wah"
    Case 8
    SomeName ="Kemp"
    Case 9
    SomeName ="Sandy"
    Case 10
    SomeName ="Lien"
    Case 11
    SomeName ="Randy"
    End Select


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width