VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



MSFlexGrid Column resizer

by Mohit Agarwal 16 (1 Submission)
Category: VB function enhancement
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (3 Votes)

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

Inputs
name of the flex grid while calling function
Assumes
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......

Rate MSFlexGrid Column resizer

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

Download this snippet    Add to My Saved Code

MSFlexGrid Column resizer Comments

No comments have been posted about MSFlexGrid Column resizer. Why not be the first to post a comment about MSFlexGrid Column resizer.

Post your comment

Subject:
Message:
0/1000 characters