Click here to Skip to main content
15,851,387 members
Please Sign up or sign in to vote.
5.00/5 (3 votes)
See more: (untagged)
When a CheckBox and some other Control are used to display a nullable variable, where the CheckBox is used to indicate whether or not the variable is null, which do you find more intuitive:

1) A check means the field IsNull
5) A check means the field HasValue

(If you're in the "use a magic value" camp, please don't respond.)

I always use checked for IsNull - seems more logical somehow

Share this answer
A check is something, an empty checkbox is missing something.
HasValue is therefore my favourite.

Whether it's subconscious or not, you might have told us your own opinion by your numbering.
Share this answer

on entry I would use a checkbox, checked==hasValue, and a TextBox or something like that, which
gets empty&&disabled or invisible on !hasValue

on display, I would use a TextBox that shows the value when hasValue, and gets both empty and
grayed when !hasValue

but then I am not sure you always need a checkbox, your control (say a TextBox) may have a
no-value indication anyhow (say a number in a TextBox, an empty TextBox would be !hasValue).
So I would only use the checkbox if the value can be present but invisible (as in an empty string).


Share this answer

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900