Search Tools Links Login

MSFlexGrid Column resizer


Visual Basic 6, or VB Classic

Hey guys out there, I make this function as i was seeking some good and easy way to make my FlexGrid look better.......I have not copied it, but if any other did the same then do tell me i will try to modify it....... and please feel free to use it and kindely also vote for me........Thanks

Original Author: Mohit Agarwal 16

Inputs

name of the flex grid while calling function

Assumptions

User must be aware of function in VB..... and coding ways..

Side Effects

Not found yet, but if u find do tell me will try to debug it......

Code

Public Function AlignGridData(FlexGrid As MSFlexGrid)
'THIS FUNCTION IS USED FOR MAKING ENOUGH SPACE FOR TEXT SO THAT THE
'TEXT HAVING MAXIMUM WIDHT CAN BE EASILY BE READ IN FLEXGRID
  Dim ObjFrm As Form
  Dim MaxCol As String
  Dim J, I As Integer
  For J = 1 To FlexGrid.Cols - 1
    MaxCol = ""
    For I = 0 To FlexGrid.Rows - 2
     If I = 0 Then
       FlexGrid.Row = 0
       FlexGrid.Col = J
'       FlexGrid.CellFontBold = True
     End If
     If FlexGrid.Parent.TextWidth(FlexGrid.TextMatrix(I, J)) > FlexGrid.Parent.TextWidth(MaxCol) Then MaxCol = FlexGrid.TextMatrix(I, J)
    Next I
    FlexGrid.ColWidth(J) = FlexGrid.Parent.TextWidth(MaxCol) * 1.6
  Next J
End Function

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 163 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.