我可以检查下拉框或组合框是否不包含特定项目?

问题描述 投票:0回答:1

此代码:

        If BunifuDropdown2.Items.Contains("30") And BunifuDropdown2.Items.Contains("31") Then

检查项目是否包含字符串30和31

        Else
            BunifuDropdown2.RemoveItem("30")
            BunifuDropdown2.RemoveItem("31")

是的,“ Else”可用于检查该项目是否不包含30和31

        End If
    End If

问题是如果项目中已删除了30和31,可以通过不使用“ Else”来检查项目中是否没有30和31,如果可能的话,我想使用“ ElseIf”。] >

Example: ElseIf BunifuDropdown2.Items.CheckIfItcontains("30") And BunifuDropdown2.Items.CheckIfItcontains("31") Then

此代码:如果BunifuDropdown2.Items.Contains(“ 30”)和BunifuDropdown2.Items.Contains(“ 31”)然后检查项目是否包含字符串30和31 Else ...

vb.net
1个回答
0
投票
If YourCombobox.Items(ThisItemYouWantToCheck) Is Nothing Then 'Do Something Else If YourCombobox.Item(ThisItemYouWantToCheckAtTheSecondPlace) Is Nothing Then 'Do Something Else 'Do Something
© www.soinside.com 2019 - 2024. All rights reserved.