我有这样的事情:
If Not String.IsNullOrWhiteSpace(selectedBeginDate) AndAlso someMoreConditionsHere Then
If somethingElse Then
' Do some work here
End If
ElseIf String.IsNullOrWhiteSpace(selectedBeginDate) Then
cell.IsEnabled = False
ElseIf Not String.IsNullOrWhiteSpace(selectedBeginDate) Then
cell.IsEnabled = True
End If
在调试If somethingElse Then
不正确时,它会正确进入
ElseIf String.IsNullOrWhiteSpace(selectedBeginDate) Then
正确地没有进入它,因为selectedBeginDate
确实有值,但我希望它会转到下一个 ElseIf
,但它跳过了它! !!!
为什么吗
答案 0 :(得分:1)
另一种解决方案:
If Not String.IsNullOrWhiteSpace(selectedBeginDate) AndAlso someMoreConditionsHere Then
If somethingElse Then
' Do some work here
End If
Else
cell.IsEnabled = Not String.IsNullOrWhiteSpace(selectedBeginDate) Then
End If