【发布时间】:2015-09-23 11:33:54
【问题描述】:
我想检查 indexpage 字符串 witf If 中的每个字符串。这是索引页
Dim indexpage As String = "string1" Or "string2"
我尝试过括号 OrElse 但它没有用.. 而且这不是 If 函数的问题。当我在没有 If 函数的情况下尝试它时,它仍然给我这个错误......
错误:
An unhandled exception of type 'System.InvalidCastException' occurred in Microsoft.VisualBasic.dll
Additional information: Conversion from string "string1" to type 'Boolean' is not valid.
【问题讨论】:
-
你希望
indexpage在这样的分配之后包含什么? -
或者您是说您要检查
indexpage是否已经等于其中任何一个字符串? -
糟糕 - 如果它在字符串列表中 not - 你的 Q 是相同的,但没有 Not。
-
你需要一个if statement。