如何一次检查一个。帮助我。 THANX [英] how to check one if at a time. help me with this. THANX

查看:90
本文介绍了如何一次检查一个。帮助我。 THANX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

if (cboaccount1.Text != "" || cboaccount2.Text != "" ||cbotitle.Text != "")
               {
                   if (!Regex.Match(cboname.Text, @"^[A-Za-z][A-Za-z. ]*$").Success)
                       MessageBox.Show("Invalid Name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                       cboname.SelectAll();
                       cboname.Focus();
                   }

推荐答案

)。成功)
MessageBox.Show( 无效名称 错误,MessageBoxButtons.OK,MessageBoxIcon.Error);
cboname.SelectAll();
cboname.Focus();
}
").Success) MessageBox.Show("Invalid Name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); cboname.SelectAll(); cboname.Focus(); }


您需要为第二部分嵌套if语句。它应如下所示:





You need to nest your if statement for the second portion. It should look like this:


if (cboaccount1.Text != "" || cboaccount2.Text != "" || cbotitle.Text != "")
               {
                 if(!Regex.Match(cboname.Text, @"^[A-Za-z][A-Za-z. ]*


)。成功)
{
MessageBox.Show( 无效名称 错误, MessageBoxButtons.OK,MessageBoxIcon.Error);
cboname.SelectAll();
cboname.Focus();
}
}
").Success) { MessageBox.Show("Invalid Name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); cboname.SelectAll(); cboname.Focus(); } }


这篇关于如何一次检查一个。帮助我。 THANX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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