1

我有两个组合框..我有一个添加按钮..如果两个组合框都有值,那么只有

我想将我的组合框项目添加到网格视图..所以我给出了这样的验证:

 If (cmbside.Text = " " And cmbDamage.Text = " ") Then
            MsgBox("Please Select Both Item", MessageBoxIcon.Information)
        End If

所以这种情况下,如果我将一个组合框值保留为空白,
那么另一个值也会添加到网格视图中。

我的代码有什么问题

4

2 回答 2

1

也许是关于“”...

If cmbside.Text = "" And cmbDamage.Text = "" Then
    MsgBox("Please Select Both Item", MessageBoxIcon.Information)
End If

或者

If cmbside.SelectedIndex = -1 And cmbDamage.SelectedIndex = -1 Then
    MsgBox("Please Select Both Item", MessageBoxIcon.Information)
End If
于 2013-10-30T07:52:12.707 回答
0

如果您想在 gridview 中添加两个组合框值,请检查这样的条件

 If ComboBox1.Text.Trim = String.Empty OrElse ComboBox2.Text.Trim = String.Empty Then
            MsgBox("Please Select Both Item", MessageBoxIcon.Information)
        End If
于 2013-10-30T07:48:46.393 回答