SysUtilsStrToInt (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This example uses two edit boxes and a button on a form. When you click the button, the code converts the values in the edit boxes to numbers, adds them, and displays a message indicating the sum.

Code

procedure TForm1.Button1Click(Sender: TObject);
var
  I: Integer;
  J: Integer;
begin
  I := StrToInt(Edit1.Text);
  J := StrToInt(Edit2.Text);
  ShowMessage(IntToStr(I + J));
end;

Uses