更新:2007 年 11 月
如果声明中使用变量建立其初始值,则编译器无法推断其数据类型。
例如,当 Option Infer 设置为 On 时,以下示例无法编译:
声明
' Does not compile with Option Infer on. Dim m = m Dim d = someFunction(d)For 循环
' Does not compile with Option Infer on. For j = 1 To j NextFor Each 循环
' Does not compile with Option Infer on. For Each customer In customer.Orders Next
**错误 ID:**BC30980
更正此错误
如果两个变量用于引用不同值,请更改要声明的变量的名称。
使用文本值代替赋值语句右侧的初始值中的变量名称。
使用 As 子句指定要声明的变量的类型。