Hi Friends,
how can i change the columns width in MSflexgrid by code from 1.jpg to 2.Jpg
I have copied this code in my Module:
Public Function Grid_AutoSize(oGrid As MSFlexGrid, oLabel As Label)
Dim nRow As Long
Dim nCol As Long
Dim nWidth As Long
Dim nMaxWidth As Long
' Setzen der Eigenschaften
With oLabel
With .Font
.Name = oGrid.Font.Name
.Size = oGrid.Font.Size
.Bold = oGrid.Font.Bold
.Italic = oGrid.Font.Italic
.Strikethrough = oGrid.Font.Strikethrough
.Underline = oGrid.Font.Underline
End With
' Wichtig!
.WordWrap = False
.AutoSize = True
End With
' Auswerten und Setzen der Grössen
With oGrid
For nCol = .FixedCols To .Cols - 1
nMaxWidth = 0
For nRow = .FixedRows To .Rows - 1
oLabel.Caption = .TextMatrix(nRow, nCol)
nWidth = oLabel.Width
If nWidth + 100 > nMaxWidth Then nMaxWidth = nWidth + 100
Next nRow
.ColWidth(nCol) = nMaxWidth
Next nCol
End With
End Function
and i have called this function in my Form Load
Grid_AutoSize msf1, lbltemp
Dim m As Long
For m = 1 To msf1.Cols + 1
msf1.ColWidth(-1) = 1400
Next
can u please help me
Thanks,
Singoi