>When we use the grid on the VFP forms. at the runtime if we keep the mouse pointer on the header of the grid we will see a downward arrow but if we click on the column header of the grid how to sort all the records like in excel and access. (Like ascending or descending.)
>
>Is it possible.
>
>Thank you very much.
Yes, the Visual Extend framework does it, for instance. (Actually, they decided to use double-click for sorting). Visual Extend even allows sorting on more than one column. You can get a demo application from their Web-site.
It is probably lots of work to implement this yourself. The basic idea, however, is to intercept the Column.Header.Click() (or DoubleClick()) Event.
Use SET ORDER to activate a specific index.
If an index doesn't exist, you can create a temporary index with:
INDEX ON (expression) TO (temp-file-name)
For temporary filenames, see function sys(2015).
Note that indexing can be slow on large tables.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)