Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The compiler cannot infer the data type of a variable if the variable is used in establishing its initial value in the declaration.
For example, with Option Infer set to On, the following examples do not compile:
Declarations
' Does not compile with Option Infer on. Dim m = m Dim d = someFunction(d)Forloop' Does not compile with Option Infer on. For j = 1 To j NextFor Eachloop' Does not compile with Option Infer on. For Each customer In customer.Orders Next
Error ID: BC30980
To correct this error
If the two variables were intended to refer to different values, change the name of the variable that you are declaring.
Use a literal value instead of the variable name in the initial value, on the right side of the assignment.
Use an
Asclause to specify the type of the variable you are declaring.