Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
646
Numeric Editor
posted

When I set the "type" of a numeric editor to decimal, start the application, dont change anything (ie accept the default 0 ("zero"))

and then call:

(decimal) numericEditor.Value

I get an exception. Why is that? When I manually type in 0, the Value parameter is castable to decimal. The default, unchanged zero seems to be an integer....

Am I doing something wrong?

Parents
No Data
Reply
  • 469350
    Suggested Answer
    Offline posted

    What's the error?

    My best guess is that the Value is null at that point, and the control simply displays a 0 for null. The solution would be to simply check for null before trying to cast the Value to a decimal.

Children