Group: Forum Members
Posts: 25,
Visits: 64
|
How is it recommended to deal with nulls?
I have fields that don't have an invalid value, and would like null to be used for these fields, IF the user does not set them
Hoping to allow this, if not, then I need to code up an extra field for each nullable value indicating "Value really set" or some such, that would be a pain.
Example is a field Daily Usage, I would like the user to be able to enter any value they wish, or to clear the value to indicate that they haven't determined it.
Getting a bunch of errors, and defaulting a Decimal to 0 will negate this option, wouldn't it?
Looking for ideas, really, at this point.
Might be due to the use of a numeric control (NumericUpDown), but seemed the "correct" control to use rather than a text box, not sure if the text box would allow nulls
If I set it to Return Alternate on Null, default value of 0, seems to work (run, but don't get the null I desire)
If set to Use Nullable Generic, then get "An error occurred while refreshing the data from field 'Hier_DataBO.DailySales' to property 'Value' on control 'numDailySales.'"
If I set to not allow nulls, get (when press edit) "Specified cast is not valid." in the field, since it defaulted to null
So seeming more and more that the numeric control just won't work with nullable values...
|