C# 检查NumericUpDown是否没有值
如何检查用户是否将NumericUpDown控件留空?我在另一个问题上看到了检查“Text”属性的方法,但没有可检查的Text属性。您可以检查C# 检查NumericUpDown是否没有值,c#,winforms,C#,Winforms,如何检查用户是否将NumericUpDown控件留空?我在另一个问题上看到了检查“Text”属性的方法,但没有可检查的Text属性。您可以检查Text属性,尽管它对设计器和IntelliSense是隐藏的 试试这个样品。它确实有效: if (string.IsNullOrEmpty(control.Text)) { // no value } 您可以对照Text属性进行检查,尽管它对设计器和IntelliSense是隐藏的 试试这个样品。它确实有效: if (string.IsNull
Text
属性,尽管它对设计器和IntelliSense是隐藏的
试试这个样品。它确实有效:
if (string.IsNullOrEmpty(control.Text))
{
// no value
}
您可以对照
Text
属性进行检查,尽管它对设计器和IntelliSense是隐藏的
试试这个样品。它确实有效:
if (string.IsNullOrEmpty(control.Text))
{
// no value
}
你可以用
if(NumericUpDown.Text == "")
{
// If the value in the numeric updown is an empty string, replace with 0.
NumericUpDown.Text = "0";
}
你可以用
if(NumericUpDown.Text == "")
{
// If the value in the numeric updown is an empty string, replace with 0.
NumericUpDown.Text = "0";
}
这起作用了,感谢您解释了为什么我在IntelliSense中看不到Text属性:)这起作用了,感谢您解释了为什么我在IntelliSense中看不到Text属性:)