1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| // Contrôle de saisie dans Edit1
try
a := StrToFloat(Edit1.Text);
except
on E: Exception do
begin
MessageDlg(E.Message, mtError, [mbOK], 0);
Edit1.SetFocus;
Exit;
end;
end;
// Contrôle de saisie dans Edit2
try
b := StrToFloat(Edit2.Text);
except
on E: Exception do
begin
MessageDlg(E.Message, mtError, [mbOK], 0);
Edit2.SetFocus;
Exit;
end;
end;
// Contrôle de saisie dans Edit3
try
c := StrToFloat(Edit3.Text);
except
on E: Exception do
begin
MessageDlg(E.Message, mtError, [mbOK], 0);
Edit3.SetFocus;
Exit;
end;
end;
// Traitement
if a = 0 then
c := a + b;
Edit3.Text := FloatToStr(c); |
Partager