...TO

AddColumn, DeleteColumn

These methods let you add and remove columns from a grid on the fly. They're more powerful than simply changing ColumnCount because they let you put the new column wherever you want it.

Usage

grdGrid.AddColumn( nColumnPosition ) grdGrid.DeleteColumn( [ nColumnPosition ] )
The column position passed to these methods refers to ColumnOrder (the visible position), not position in the Columns collection (which is based on creation order). When you DeleteColumn, the columns after that one move up in the Columns collection. Added columns always go at the end of the collection, regardless of their ColumnOrder.

In Help for VFP 5 and before, it says DeleteColumn removes the active column if you don't pass the parameter. T'ain't so. If you omit the nColumnPosition parameter, DeleteColumn tosses out the last column in ColumnOrder regardless of ActiveColumn. Fortunately, this was fixed in VFP 6.


Example

This.DeleteColumn(2)            && Remove second column Thisform.grdMyGrid.AddColumn(3) && Add a column, make it third

See Also

AddObject, ColumnCount, ColumnOrder, Columns, RemoveObject


View Updates

Copyright © 2002 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. All Rights Reserved.



Hacker's Guide to Visual FoxPro 7. 0
Hackers Guide to Visual FoxPro 7.0
ISBN: 1930919220
EAN: 2147483647
Year: 2001
Pages: 899

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net