Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Record counter in grid
Message
From
11/12/2004 14:09:47
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
11/12/2004 13:54:04
Reza Meamar
Homa Programming Group
Shiraz, Iran
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows '98
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00968563
Message ID:
00968564
Views:
8
>Hi all
>I want to have a column in my grid to show records number.
>I dont want to have a field in my cursor for this counter.
>I want when i ADD or DELETE a record from grid, the counter rearranged.
>Can i do this?
>Thanks for your suggestion

You could use the recno() function, and base the grid on a view.

However, deleting a record would require to refresh the view, to update the record numbers.

Another option, if you have few records, is a UDF which counts the records from the top of the table. For a lot of records, this would be too slow.

Also, perhaps you should reconsider adding an additional field. For instance, in one case, I automatically put numbers, in increments of 10 (10, 20, 30, ...). The user could re-order the rows, by changing the numbers (for instance, to put the third row before the second, change the "30" to "15"). A "renumber" button on the form would "clean up" the numbers, i.e., make the first record equal to 10, the second to 20, etc.
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)
Previous
Reply
Map
View

Click here to load this message in the networking platform