Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Основная";
Текущий архив: 2002.07.29;
Скачать: [xml.tar.bz2];

Вниз

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

 
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 вся ветка

Форум: "Основная";
Текущий архив: 2002.07.29;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.44 MB
Время: 0.006 c
14-95540
DeMoN-777
2002-07-02 18:23
2002.07.29
Самый простой алгоритм часов


1-95288
Ученик
2002-07-16 08:43
2002.07.29
Блокирование событийных методов On*


4-95627
Yerba
2002-05-21 14:29
2002.07.29
О установке своего языка


3-95179
Oleon
2002-07-05 13:13
2002.07.29
Переход с Local InterBase на InterBase Server


1-95403
Smok_er
2002-07-10 17:49
2002.07.29
Изменение цвета/стиля надписи на TTabSheet





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский