Results 1 to 3 of 3

Thread: Help with FlexGrid please --> Resolved

  1. #1

    Thread Starter
    Frenzied Member RudyL's Avatar
    Join Date
    Mar 2001
    Location
    Chicago
    Posts
    1,519

    Question Help with FlexGrid please --> Resolved

    I am using the dredid MS Flex Grid and my question is how would I take the text in a cell and use it to set the column width accordingly?


    Rudy
    Last edited by RudyL; Mar 2nd, 2004 at 11:19 PM.
    10 different ways to skin a cat and amazingly enough each and every one has the same result, the cat gets skinned! The same can be applied to code, so be nice and accept each others "preferences".

  2. #2

  3. #3

    Thread Starter
    Frenzied Member RudyL's Avatar
    Join Date
    Mar 2001
    Location
    Chicago
    Posts
    1,519
    Originally posted by MartinLiss
    MSFlexGrid1.ColWidth(1) = TextWidth(MSFlexGrid1.TextMatrix(1, 1)) + 120
    Thanks Martin.. That is exactly what I needed.. With a few additions it works perfectly

    VB Code:
    1. Dim row_num As Integer
    2. Dim col_num As Integer
    3. Dim max_width As Single
    4.  
    5. With frmProjects
    6.     For col_num = 0 To .fgProjects.Cols - 1
    7.         max_width = 0
    8.         For row_num = 0 To .fgProjects.Rows - 1
    9.             If max_width < TextWidth(.fgProjects.TextMatrix(row_num, col_num)) Then
    10.                 max_width = TextWidth(.fgProjects.TextMatrix(row_num, col_num))
    11.             End If
    12.         Next row_num
    13.         .fgProjects.ColWidth(col_num) = max_width + 240
    14.     Next col_num
    15. End With

    Thanks again for the tip!

    Rudy
    10 different ways to skin a cat and amazingly enough each and every one has the same result, the cat gets skinned! The same can be applied to code, so be nice and accept each others "preferences".

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