Is it a stringgrid or a dbgrid? If it's a stringgrid you could just cycle through and add them up, if a dbgrid you could go through the query records and add them up or you could request a sum from the database.
If you're trying to sum up only records they selected I think that multiple select in dbgrids gives you a list of bookmarks you could run through.
Its a dbgrid and I select a list of recoreds for a customer, like a order of 10 different products. When the user tabs or moves to the next line, I would like it to update the amount due. s-)
The difficulty I've found with this kind of thing is not doing the calculation, but triggering it. OnColExit catches tabbing across columns and to get the move to the next line you can use OnDataChange of the DBGrid's DataSource. However if you want to change anything on the relevant table(s) then you may get a loop with OnDataChange calling itself!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.