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
Printable View
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
MSFlexGrid1.ColWidth(1) = TextWidth(MSFlexGrid1.TextMatrix(1, 1)) + 120
Thanks Martin.. That is exactly what I needed.. With a few additions it works perfectly :)Quote:
Originally posted by MartinLiss
MSFlexGrid1.ColWidth(1) = TextWidth(MSFlexGrid1.TextMatrix(1, 1)) + 120
VB Code:
Dim row_num As Integer Dim col_num As Integer Dim max_width As Single With frmProjects For col_num = 0 To .fgProjects.Cols - 1 max_width = 0 For row_num = 0 To .fgProjects.Rows - 1 If max_width < TextWidth(.fgProjects.TextMatrix(row_num, col_num)) Then max_width = TextWidth(.fgProjects.TextMatrix(row_num, col_num)) End If Next row_num .fgProjects.ColWidth(col_num) = max_width + 240 Next col_num End With
Thanks again for the tip!
Rudy
:bigyello: :bigyello: :D :D