Delphi: auto addition in StringGrid

757 views Asked by At

It is possible to make a calculator who calculate the addition of 2 or more cells of a StringGrid and show the result in other cell?

For example:

I have a String grid with 6 cells. I want to show in the 6th cell 1st cell+2nd cell+3rd cell+4th cell+5th cell.

And if the response is 'YES' how can I do this?

1

There are 1 answers

1
Rob Kennedy On

Yes, it's certainly possible to write such a program.

Read the values in the cells, convert them to integers, add them, convert the result back to a string, and store that string in the cell designated for the result.

To detect changes to the editable cells, you might wish to handle the OnSetEditText event of the grid control.