The Width Of The Columns Of The FlexGrid/MSFlexGrid/MSHFlexGrid Control Get Adjusted Depending Upon
The Width Of The Columns Of The FlexGrid/MSFlexGrid/MSHFlexGrid Control Get Adjusted Depending Upon The Maximum Length Of The Text In Each Row
API Declarations
'IMPORTANT: - The Font Property Of The Form And The Grid Control Must Be Same.
Rate The Width Of The Columns Of The FlexGrid/MSFlexGrid/MSHFlexGrid Control Get Adjusted Depending Upon
(1(1 Vote))
'''''''''''''''''''''''''' Start From This ''''''''''''''''''''''''''''''''
gridtitles = Array("Customer ID", "Name", "Address", "Telephone No")
Call InitGrid(MSFlexGrid1, 1, 4, gridtitles)
'''''''''''''''''''''''' Upto This ''''''''''''''''''''''''''''''''''''''''
Sub InitGrid(msflexName As Control, rowCount As Integer, ColCount As Integer, ColArray)
If (TypeOf msflexName Is MSFlexGrid) Or (TypeOf msflexName Is MSHFlexGrid) Then
With msflexName
.Rows = rowCount
.Cols = ColCount
For i = 0 To ColCount - 1
.TextMatrix(0, i) = ColArray(i)
Next
End With
End If
End Sub
Sub NewColumnWidth(FlexGridName As Control, frmName As Form)
'Width of the current column gets increased depending upon the maximum length of 'the text present in that column
Dim i, j, columnwidth As Integer
columnwidth = 0
If (TypeOf FlexGridName Is MSFlexGrid) Or (TypeOf FlexGridName Is MSHFlexGrid) Then
With FlexGridName
For j = 0 To .Cols - 1
For i = 0 To .Rows - 1
If columnwidth < frmName.TextWidth(Trim(.TextMatrix(i, j))) Then
columnwidth = frmName.TextWidth(Trim(.TextMatrix(i, j)))
endif
Next
.ColWidth(j) = columnwidth + 100
columnwidth = 0
Next
End With
End If
End Sub
The Width Of The Columns Of The FlexGrid/MSFlexGrid/MSHFlexGrid Control Get Adjusted Depending Upon Comments
No comments yet — be the first to post one!
Post a Comment