我有3对列表框。
我希望只有当两个列表框都填充在一起时才能继续执行程序。
必须填写包含lb1stDebugError
和lb1stDebug
的第一对。
如果对中的ListBox
为空,则可以从验证中排除其他对。
验证工作正常,但需要填写所有列表框才能继续。
如何修改代码?
这是我的代码:
If lb1stDebugError.Items.Count = 0 Or lb1stDebug.Items.Count = 0 Then
pnFCTTesting.Visible = False
PanelFCTTestingInitialResult.Visible = False
lblDebugWarningInfo.Visible = True
ElseIf lb2ndDebugError.Items.Count = 0 Or lb2ndDebug.Items.Count = 0 Then
pnFCTTesting.Visible = False
PanelFCTTestingInitialResult.Visible = False
lblDebugWarningInfo.Visible = True
ElseIf lb3rdDebugError.Items.Count = 0 Or lb3rdDebug.Items.Count = 0 Then
pnFCTTesting.Visible = False
PanelFCTTestingInitialResult.Visible = False
lblDebugWarningInfo.Visible = True
End If
感谢您的帮助:)
答案 0 :(得分:0)
我认为这就是你要找的东西:
Dim pair1Valid = (lb1stDebugError.Items.Count > 0 AndAlso lb1stDebug.Items.Count > 0) _
OrElse (lb1stDebugError.Items.Count = 0 AndAlso lb1stDebug.Items.Count = 0)
Dim pair2Valid = (lb2ndDebug.Items.Count > 0 AndAlso lb2ndDebug.Items.Count > 0) _
OrElse (lb2ndDebug.Items.Count = 0 AndAlso lb2ndDebug.Items.Count = 0)
Dim pair3Valid = (lb3rdDebugError.Items.Count > 0 AndAlso lb3rdDebug.Items.Count > 0) _
OrElse (lb3rdDebugError.Items.Count = 0 AndAlso lb3rdDebug.Items.Count = 0)
Dim allValid = pair1Valid AndAlso pair2Valid AndAlso pair3Valid
pnFCTTesting.Visible = allValid
PanelFCTTestingInitialResult.Visible = allValid
lblDebugWarningInfo.Visible = Not allValid