Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何检查 C# 中的屏蔽文本框是否为空,即用户没有输入任何内容?
我的文本框只允许输入 4 个数字。
谢谢
您可以检查TextMaskedTextBox 的属性是否null为String.Empty
Text
null
String.Empty
if (String.IsNullOrEmpty(maskedTextBox1.Text)) { //no input }
试试这个:
maskedTextBoxInput.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals; if (maskedTextBoxInput.Text == "") { ... }