Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Not a valid Integer

0 views
Skip to first unread message

Michael Williams

unread,
Apr 10, 2001, 11:05:12 AM4/10/01
to
> I am getting an infrequent dialog box pop up in my program that a certain
> string is not a valid integer, i.e. '"+OK" is not a valid integer.' The
> dialog box just has an OK in it, and the Title of my application as the
> Dialog Box title.

Most likely StrToInt is throwing an exception when you pass it a string that
does not contain a valid number. If you are running the program in the IDE
be sure to set "break on exceptions."

-Mike


Glenn Polin

unread,
Apr 10, 2001, 10:43:23 AM4/10/01
to
I am getting an infrequent dialog box pop up in my program that a certain
string is not a valid integer, i.e. '"+OK" is not a valid integer.' The
dialog box just has an OK in it, and the Title of my application as the
Dialog Box title.

This isn't from my code. I have a vague idea of where the +OK comes from,
but I haven't been able to track it down. The error occurs infrequently, in
a program that runs continuously, so for that reason and others I can't
easily put in breakpoints and just debug it.

(1) Could this message come from an IntToStr? I would think that almost
any pattern inside an integer, even if overwritten, would still look like an
integer.

(2) If not an IntToStr, then is there any Borland function that would
produce this message?

(3) If not from a Borland function, should I assume it's from a package
I'm using?

Thanks for any help!

Glenn Polin


Michael Williams

unread,
Apr 10, 2001, 11:30:30 AM4/10/01
to
> But I'm not getting an exception, just a dialog box. Would StrToInt
> actually create an exception? This does not stop my program, just puts up
> the dialog box.

Yes, StrToInt creates an exception. If your code does not handle the
exception the default exception handler throws up a dialog box just like
what you've described.

-Mike


Glenn Polin

unread,
Apr 10, 2001, 11:21:47 AM4/10/01
to
But I'm not getting an exception, just a dialog box. Would StrToInt
actually create an exception? This does not stop my program, just puts up
the dialog box.

Glenn
"Michael Williams" <mi...@remove.aps-soft.com> wrote in message
news:3ad3211b_2@dnews...

Michael B. Klein

unread,
Apr 10, 2001, 10:56:32 PM4/10/01
to
"Glenn Polin" <gl...@hudsonsoft.com> wrote in message
news:3ad32588$1_2@dnews...

> But I'm not getting an exception, just a dialog box. Would StrToInt
> actually create an exception? This does not stop my program, just puts up
> the dialog box.

Assuming that StrToInt is throwing this exception and that you're running
under the IDE debugger, several things are possible here:

1) You have "Stop on Delphi exceptions" turned off in the debugger options.
2) You have EConvertError in your list of Delphi exceptions to ignore.
3) The exception is being handled by the procedure that called StrToInt, and
throwing up a dialog box in the except block (though even this would cause a
break under the debugger if you have "Stop on Delphi exceptions" checked).

Your best bet is to set a breakpoint somewhere before the error, and step
into everything (F7) until the dialog box appears. Then at least you might
narrow it down to a given package or unit.

Michael

0 new messages