Вниз
Скачать: CL | DM;

Уважаемые мастера, Как обработать ошибку???   Найти похожие ветки 

 
DARS73 ©   (2002-07-17 00:59) [0]

Tекстовое поле Edit1.text:="*11" я выполняю команду strtofloat(edit1.text) и получаю ошибку, мне нужно эту ошибку обработать.
То есть мне нужно определить, введеные символы в edit1.text являются числом или нет, кто может помогите. За ранее благодарен.


 
Ev_genus ©   (2002-07-17 01:13) [1]

Есть такая процедура
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:15) [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 :)


 
Alexander_D6_XP   (2002-07-17 01:24) [3]

Например можно так:

try
strtofloat();
showmessage("ok");
except
showmessage("entered text isn"t a number!");
end;



Страницы: 1 вся ветка

Скачать: CL | DM;



Память: 0.45 MB
Время: 0.009 c
14-95486
w
2002-06-30 19:46
2002.07.29
w


1-95405
SuperVK
2002-07-16 05:41
2002.07.29
Как в TStringGrid сделать выделение столбца?


3-95270
Vell S
2002-07-09 13:22
2002.07.29
BDE (paradox)


1-95360
Andrushk
2002-07-15 16:16
2002.07.29
Как сохранить кучу разнородной информации в одном файле


3-95259
_Bl@dE_
2002-07-08 21:05
2002.07.29
драйвера dbExpress для MS Access 2000 и Paradox




   Наверх