Why during the conversion is not caught an exception, but a system error is caused?
int n = 0; int alfa = 255; try { n = StrToInt(Edit1->Text); } catch(EConvertError &e){}; try { alfa = StrToFloat(Edit2->Text); } catch(EConvertError &e){};
Why during the conversion is not caught an exception, but a system error is caused?
int n = 0; int alfa = 255; try { n = StrToInt(Edit1->Text); } catch(EConvertError &e){}; try { alfa = StrToFloat(Edit2->Text); } catch(EConvertError &e){};
if(!TryStrToInt(...)) Application->MessageBoxA(....)
This is how it works:
bool Err = false; double dValue; AnsiString s = "5.3"; try { dValue = s.ToDouble(); } catch(EConvertError&) { Err = true; } if(Err) { DecimalPoint = ','; OppositePoint = '.'; } else { DecimalPoint = '.'; OppositePoint = ','; }
Source: https://ru.stackoverflow.com/questions/67255/
All Articles