
Set Grid width to sum of Column Widths
I am trying to set the width and height of a flexGrid to fit the rows and
columns exactly. The code below comes close but still cuts out part of the
last col and last row. I am adding 10 to cover the grid lines, but I am
guessing at the value.
Is there a good technique to do this exactly?
Thanks
Public Function SetGridDim(g As MSFlexGrid)
iTotal = 0
For i = 0 To g.Rows - 1
iTotal = iTotal + g.RowHeight(i) + 10
Next i
g.Height = iTotal
iTotal = 0
For i = 0 To g.Cols - 1
iTotal = iTotal + g.ColWidth(i) + 10
Next i
g.width = iTotal
End Function