我的if语句有问题,无法在vb.net代码中正确执行我的代码

时间:2019-05-22 10:11:49

标签: vb.net

我正在为客户创建一个新系统,当我按下创建客户时,我的if语句无法在我的客户表单上正确执行。

我尝试切换到Case Statement无法解决我的问题,然后返回if语句,然后我为需要填写的每个必填字段做了一行。当我填写“帐户详细信息”时,也没有任何反应。

VB.NET

If btnNew.Text = "New Customer" Then

    cuscontrol.TabPages.Remove(cuslist)
    cuscontrol.TabPages.Add(cusnew)
    btnNew.Text = "Create Customer"
    btnSMS.Visible = False
    btnMail.Visible = False
    btnDoc.Visible = False
    btnClose.Text = "Cancel"

ElseIf btnNew.Text = "Create Customer" Then

    If cusname.Text = "" Or custype.Text = "" Or paytype.Text = "" Or cname.Text = "" Or idtype.Text = "" Or idno.Text = "" Or title.Text = "" Or cmobile.Text = "" Or cmail.Text = "" Then

        MetroMessageBox.Show(Me, "Complete Required Fields!", "BMS Error", MessageBoxButtons.OK, MessageBoxIcon.Error)

    ElseIf acc.Visible = True Then

        If accno.Text = "" Or accname.Text = "" Or accper.Text = "" Then

            MetroMessageBox.Show(Me, "Complete Required Fields!", "BMS Error", MessageBoxButtons.OK, MessageBoxIcon.Error)

        End If

    ElseIf cntype.Enabled = True Then

        If cntype.Text = "" Then

            MetroMessageBox.Show(Me, "Complete Required Fields!", "BMS Error", MessageBoxButtons.OK, MessageBoxIcon.Error)

        End If

    ElseIf custype.Text = "Business" Then

        If vat.Text = "" Or office.Text = "" Or mail.Text = "" Then

            MetroMessageBox.Show(Me, "Complete Required Fields!", "BMS Error", MessageBoxButtons.OK, MessageBoxIcon.Error)

        End If

    ElseIf custype.Text = "Business" Then

        If vat.Text = "" Or office.Text = "" Or mail.Text = "" Then

            MetroMessageBox.Show(Me, "Complete Required Fields!", "BMS Error", MessageBoxButtons.OK, MessageBoxIcon.Error)

        End If

    Else

        MessageBox.Show("Success")

    End If

End If

我没有收到任何错误,什么都没有发生,成功消息框假设可以显示代码是否正确执行。

当我按下“创建客户”按钮时,我需要我的表单。它需要检查所有必填字段是否都已填写(我尚未从验证开始)。如果为Null,则MessageBox.Show(“请完成必填字段”)

0 个答案:

没有答案