空变量指示 [英] Indication of null variables

查看:102
本文介绍了空变量指示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当使用CheckBox和其他控件显示可为空的变量时,使用CheckBox指示变量是否为null,您会觉得更直观:

1)检查表示字段IsNull
5)选中表示字段HasValue


(如果您位于使用魔术值"阵营中,请不要响应.)

解决方案

我一直使用IsNull的检查方法-似乎更合乎逻辑


检查是对的,一个空的复选框缺少某些内容.因此,
HasValue是我的最爱.

无论它是否处于潜意识状态,您都可以通过编号告诉我们自己的意见.


您好,

在输入项中,我将使用一个复选框,checked == hasValue和一个TextBox或类似的东西,这些东西在 Value!上禁用或不可见!在显示时,我将使用一个文本框,该文本框在hasValue时显示值,并且同时为空和
graye d当!hasValue

但我不确定您是否始终需要一个复选框时,您的控件(例如TextBox)可能仍然具有
无值指示(例如TextBox中的数字,空TextBox将会是!hasValue).
因此,我只会在该值可以存在但不可见(例如在空字符串中)的情况下使用此复选框.

:)


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


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.


Hi,

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).

:)


这篇关于空变量指示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆