CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: MSFlexGrid

  1. #1
    Guest

    MSFlexGrid

    At a complete loss as to how to add titles to the columns in a MSFlexGrid control. Any help for this beginner would be appreciated.


  2. #2
    Guest

    Re: MSFlexGrid

    is the 'title' mean Column heading? if so,

    Dim strDBField() As String
    Dim iCount As Integer

    ReDim strDBField(3)
    strDBField(0) = "Month" 'name of the fields.
    strDBField(1) = "Total Amount"
    ' Create number of columns to equal, at least, number of fields.
    If flexgrid.Cols < UBound(strDBField, 1) + 1 Then
    flexgrid.Cols = UBound(strDBField, 1) + 1
    End If
    ' Populate grid header with field names.
    For iCount = 0 To UBound(strDBField, 1)
    flexgrid.TextMatrix(0, iCount) = strDBField(iCount)
    Next

    Hope this helps.

    Bill.


  3. #3
    Guest

    It Works, But...

    Thanks for your help Bill; works great!

    Except your code leaves me with one unlabeled column at the end. How would I get rid of that?


  4. #4
    Join Date
    Sep 1999
    Posts
    4

    Re: It Works, But...

    I am sorry. you have to change ReDim strDBField(3) to ReDim strDBField(1) i.e, '1' less than the total no of fields. also in propertypages Generel tab change the cols to 2.

    Bill.


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

Featured