Here is a Generic routine I've put together a while back:
VB Code:
Public Sub ResizeGrid(pGrid As MSFlexGrid, pForm As Form) Dim intRow As Integer Dim intCol As Integer With pGrid For intCol = 0 To .Cols - 1 For intRow = 0 To .Rows - 1 If .ColWidth(intCol) < pForm.TextWidth(.TextMatrix(intRow, intCol)) + 100 Then .ColWidth(intCol) = pForm.TextWidth(.TextMatrix(intRow, intCol)) + 100 End If Next Next End With End Sub
Then just call this routine like this:
ResizeGrid MSFlexGrid1, Form1




Reply With Quote