-1

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 Answers1

0

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.

Rob Kennedy
  • 161,384
  • 21
  • 275
  • 467
  • You're right, Rob Kennedy! this is what i do, and it works: `procedure TForm1.Button1Click(Sender: TObject); var a,b,c: string; d: integer; begin a:=stringgrid1.Cells[1,1]; b:=stringgrid1.Cells[2,1]; c:=stringgrid1.Cells[3,1]; d:=strtoint(a)+strtoint(b)+strtoint(c); stringgrid1.Cells[4,1]:=inttostr(d); end;` – user2714141 Sep 11 '13 at 14:25