我的WPF中有多个textBox,并想根据所需的应用程序逻辑检查它们是否正确填写:
textBox1 - 总是mandadory填写
textBox2 - 总是mandadory填写
textBox3 - if!string.IsNullOrEmpty - > textBox4也必须填写
textBox4 - if!string.IsNullOrEmpty - > textBox3也必须填写
textBox5 - if!string.IsNullOrEmpty - > textBox6也必须填写
textBox6 - if!string.IsNullOrEmpty - > textBox5也必须填写
所以texBox3和4都填写了-OR- textBox5和6或者全部3 4 5 6 .
我试过if语句,if语句带||布尔逻辑等 . 我总是陷入困境,最终得到一个不起作用的解决方案 .
这是一个直接的开始,但从来没有进一步的东西可行:
if (string.IsNullOrEmpty(textBox1.Text) || string.IsNullOrEmpty(textBox1.Text))
{
MessageBox.Show("Fill out textBox1 and textBox2");
}
提前感谢您的任何建议 .
1 回答