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 ] ) |
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 |