Cannot infer a common type for the second and third operands of the 'If' operator
Cannot infer a common type for the second and third operands of the 'If' operator. One must have a widening conversion to the other.
When the If operator is called with three arguments, there must be a widening conversion between the second and third arguments. For example, because there is not a widening conversion in either direction between Integer and String, the following code causes this error.
Dim divisor = 3
' Not valid.
' Console.WriteLine(If(divisor <> 0, number \ divisor, "Division by zero"))
Error ID: BC33106
To correct this error
Provide an explicit conversion for one of the operands, if that is possible in your code.
Use a different condition construction, such as an If...Then...Else statement.
See Also
Concepts
Widening and Narrowing Conversions