Unit1.pas 738 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. unit Unit1;
  2. interface
  3. uses
  4. Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5. Dialogs, StdCtrls;
  6. type
  7. TForm1 = class(TForm)
  8. lbl1: TLabel;
  9. lbl2: TLabel;
  10. edt1: TEdit;
  11. edt2: TEdit;
  12. btn1: TButton;
  13. lbl3: TLabel;
  14. procedure btn1Click(Sender: TObject);
  15. private
  16. { Private declarations }
  17. public
  18. { Public declarations }
  19. end;
  20. var
  21. Form1: TForm1;
  22. implementation
  23. {$R *.dfm}
  24. { Realiza la acción de sumar. }
  25. procedure TForm1.btn1Click(Sender: TObject);
  26. var
  27. valor1: Integer;
  28. valor2: Integer;
  29. resultado: Integer;
  30. begin
  31. valor1 := StrToInt(edt1.Text);
  32. valor2 := StrToInt(edt2.Text);
  33. resultado := valor1 + valor2;
  34. lbl3.Caption := IntToStr(resultado);
  35. end;
  36. end.