gpt4 book ai didi

c# - If语句具有多个空文本框

转载 作者:太空宇宙 更新时间:2023-11-03 18:07:20 25 4
gpt4 key购买 nike

if (txtUserID.Text == String.Empty && 
txtFN.Text == String.Empty &&
txtMI.Text == String.Empty &&
txtLN.Text == String.Empty &&
txtUsername.Text == String.Empty &&
txtPassword.Text == String.Empty &&
txtConfirm.Text == String.Empty)
{
XtraMessageBox.Show("All fields are required!",
"Warning",
MessageBoxButtons.OK,
MessageBoxIcon.Warning);
}


大家好,有人可以给我正确的代码。我想确认一下,如果在输入数据时还有一个空的文本框,除非填充所有空白的文本框,否则系统将不会继续运行:)

最佳答案

您有AND(&&),应为OR(||)

if (txtUserID.Text == String.Empty || txtFN.Text == String.Empty || txtMI.Text == String.Empty || txtLN.Text == String.Empty || txtUsername.Text == String.Empty || txtPassword.Text == String.Empty || txtConfirm.Text == String.Empty)
{
XtraMessageBox.Show("All fields are required!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}

关于c# - If语句具有多个空文本框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24764796/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com