The best solution (IMHO) is to use TryStrToFloat :
procedure TForm1.Button1Click(Sender: TObject); var myfloat: double; begin if TryStrToFloat(Edit1.Text, myfloat) then DataModule.tbTableNumber.Value := myfloat else ShowMessage('Incorrect value.'); end;
I donโt think that the use of try..except is especially โcleanโ when the error is as trivial and, in fact, as expected, as in this case.
Andreas Rejbrand
source share