![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
Уважаемые мастера, Как обработать ошибку??? [D6, Win95/98, WinXP]
DARS73 © (2002-07-17 00:59:00)Tекстовое поле Edit1.text:="*11" я выполняю команду strtofloat(edit1.text) и получаю ошибку, мне нужно эту ошибку обработать.
То есть мне нужно определить, введеные символы в edit1.text являются числом или нет, кто может помогите. За ранее благодарен.
Alexander_D6_XP (2002-07-17 01:24:00) [1]Например можно так:
try
strtofloat();
showmessage("ok");
except
showmessage("entered text isn"t a number!");
end;
Ev_genus (2002-07-17 01:15:00) [2]Есть такая процедура
procedure Val(S; var V; var Code: Integer);
If the string is invalid, the index of the offending character is stored in Code; otherwise, Code is set to zero. For a null-terminated string, the error position returned in Code is one larger than the actual zero-based index of the character in error.
Номер символа на котором происходит ошибка сохраняется в Code. Eсли Code = 0 , то все := OK :)
Ev_genus (2002-07-17 01:13:00) [3]Есть такая процедура
procedure Val(S; var V; var Code: Integer);
If the string is invalid, the index of the offending character is stored in Code; otherwise, Code is set to zero. For a null-terminated string, the error position returned in Code is one larger than the actual zero-based index of the character in error.
Номер символа на котором происходит ошибка сохраняется в Code. Eсли Code = 0 , то все = OK :)