我正在设置一个程序,以测试文本框是否包含某些值并且不包含其他某些值。
For I = 0 To 3
If textbox(I).Contains("m") And Not textbox(I).Contains(unit(0)) And Not textbox(I).Contains(unit(1)) And Not textbox(I).Contains(unit(2)) Then
txtResult = textbox(I)
End If
Next I
代码有效,但是我想知道是否有一种简化方法
textbox(I).Contains(unit(0)) And Not textbox(I).Contains(unit(1)) And Not textbox(I).Contains(unit(2))
正如在实际代码中一样,程序通过的“ unit(I)
”值更多,这已得到简化。