ColumnOrder, PageOrder

These properties determine the position of columns in a grid and pages in a page frame, respectively. They affect the display, but not the underlying structure. They also affect some other properties, leading to a total mishmash for accessing individual columns or pages.

Usage

colColumn.ColumnOrder = nWhatPosition
nWhatPosition = colColumn.ColumnOrder
pagPage.PageOrder = nWhatPosition
nWhatPosition = pagPage.PageOrder
Regardless of the ColumnOrder or PageOrder you specify, the drop-down list in the Property Sheet and the appropriate collection property (Columns or Pages) show the columns or pages in their original creation order. But other properties reflect the current order. When you reduce the number of columns or pages, the ones discarded are the ones with the highest ColumnOrder or PageOrder. ActiveColumn and ActivePage are also based on the current ordering, not the underlying order. This last business is a real problem, since this means you can't use ActiveColumn or ActivePage as an index into Columns or Pages. The only way (other than using This) to get a handle on the active page or column is to use brute force to loop through the pages or columns to match the active one. What would be really nice here is a dual structure like the one used for lists and combos that gives you access both by creation order and by current display order.When you change the order of one page or column, others may change as well. Oddly, the way they change differs. For pages, the new PageOrder must be between 1 and PageCount. (Actually, 0 is accepted, but it's treated just like 1.) The pages between the new position and the end all get pushed to the right.Columns are different. First, the property sheet has a unique way of rejecting values out of bounds. If you type a value that's not between 1 and ColumnCount, it's summarily rejected and replaced with the column's current ColumnOrder. At runtime, values out of range are simply ignored, as if you didn't even issue the command. When you change ColumnOrder to something acceptable, that column and the one that already had the specified ColumnOrder change places. That is, if you take the column with ColumnOrder=4 and change its ColumnOrder to 7, it becomes the seventh column (visually), and the column that was seventh moves to fourth. What this means is that it's a heckuva lot easier to rearrange the columns with your mouse than by manipulating ColumnOrder.

Example

ThisForm.grdEmployee.colFirstName.ColumnOrder = 1

See Also

ActiveColumn, ActivePage, Column, Columns, Grid, Page, PageFrame, Pages


Back to Table of Contents

Copyright © 2002-2018 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. Click for license .