I don't know of any property that you can set to get the MSFlexgrid to
autosize its columns to the width of the widest cell in the column. But
here is a subprocedure that seems to accomplish the same thing:
Private Sub AutosizeColumns(myGrid As MSFlexGrid)
Dim RowCounter As Long, ColCounter As Long, MaxCellWidth As Single
For ColCounter = 0 To myGrid.Cols - 1
MaxCellWidth = 0
myGrid.Col = ColCounter
For RowCounter = 0 To myGrid.Rows - 1
myGrid.Row = RowCounter
If TextWidth(myGrid.Text) > MaxCellWidth Then
MaxCellWidth = TextWidth(myGrid.Text)
End If
Next RowCounter
'Enforce a minimul column width
If MaxCellWidth = 0 Then MaxCellWidth = 200
'Add a 12% padding to the column width
myGrid.ColWidth(ColCounter) = MaxCellWidth * 1.12
Next ColCounter
End Sub
Send the sub the grid to autosize like this:
AutosizeColumns grdSalesItems
Hope this helps,
Kerry Moorman
Luca Bianchi wrote in message <38933416...@galactica.it>...
>Please,help me!
>Thanks.
>
When you build your SQL Select string that you will use to open a recordset,
specify the fields you want in the order you want them.
In other words, instead of
Select * From Inventory
use
Select InventoryID, ProductName, Instock From Inventory
Hope this helps,
Kerry Moorman
Mr Todd Hampton wrote in message <38a47fbd....@enews.newsguy.com>...