I’m working with visual studio 2008 developing software for windows CE 6.0, compact framework.
I’m having this “strange?” trouble with isNumeric method. Is there another better way to do this job? Why is getting me an exception? (two in facts…both of type FormatException)
Thank you
dim tmpStr as object = "Hello"
if isNumeric(tmpStr) then // EXCEPTIONs on this line
// It's a number
else
// it's a string
end if
Even though the
FormatExceptionisn’t listed in the documentation ofIsNumericit is indeed one of the exceptions that can be thrown. The circumstances under which it will be thrown are0xor&HprefixI couldn’t find any rationale for this behavior though. The only way I was even able to discern it was by digging through the implementation in reflector.
The best way to work around it seems to be to define a wrapper method