Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to sum a column of a grid control
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00638188
Message ID:
00638263
Views:
21
Hang,

Make your life easier and forget that the grid is ther instead work with the rowsource of the grid. In the textbox's refresh event put this code;
LOCAL lnRecno, lcAlias
lcAlias = ALIAS()
SELECT (Thisform.Grid.RowSource)
lnRecno = RECNO()
SUM TheFieldYouWant TO This.Value
IF lnRecNo < RECCOUNT()
   GOTO lnRecNo
ELSE
   GO BOTTOM
   SKIP
ENDIF
IF EMPTY(lcAlias)
   SELECT 0
ELSE
   SELECT (lcAlias)
ENDIF
Now whenever the data in the grid changes you can;
Thisform.Textbox.Refresh()
and get the total displayed.
Previous
Reply
Map
View

Click here to load this message in the networking platform