开发者

How do I identify what code is generating " '' is not a valid floating point value" error dialogue box

I am using Delphi 2010 and have a program which keeps generating an error dialog box stating

开发者_Go百科

'' is not a valid floating point value

How do I get delphi to show me the line that generated that error?


The easiest way to solve this is to run under the debugger and have it configured to Notify on language exceptions, Tools | Options:

How do I identify what code is generating " '' is not a valid floating point value" error dialogue box

Ignore the big list of exceptions to ignore that come from my own codebase. Just make sure the checkbox I have highlighted is marked.

Then when you run your program, it will stop at the line that causes the exception.


Search your code for StrToFloat function. This function raises an exception if the parameter is an empty string. You can replace the function call with:

if Trim(StrV) = '' then StrV := '0.0'; f := StrToFloat(StrV);

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜