I have a NumericEditor on a windows form. In the value change event, I'm trying to check to see if they entered a valid value. Everything works fine unless they enter nothing. When I try and cast the numEditor.Value as an int, it throws an exception. When looking at the .Value in debug mode it shows { }. It does not evaluate to null or empty string (""). Any ideas what this { } value resolves to?
It sounds like it is resolving to DBNull.Value.
-Matt
I should have mentioned it is tied to a business object (class) as it's data source. The property it's tied to is a Nullable<int> So, it cannot resove to DBNull.
Thanks Matt, you were right, The {} equates to DBNull. Just thought it was odd that when my business object is not loaded the value of the numeric editor is null. Then when I fill the business object and the user erases the value from the form it changes to DBNull. So, my validation logic has to check for both.
Off the top of my head, I think that it's returning DBNull.Value because the underyling editor works with this for general compatibility purposes instead of null, though I think there's an additional reason that I'm not thinking of. Is there a reason that you can't check for DBNull and just convert it to null or whatever value you want instead?