Conditional block not upgraded because an expression evaluates to False
Visual Basic 6.0 supported conditional compilation using the #If...#EndIf statement syntax and conditional compilation constants. During compilation, only the code block that evaluated to true would be compiled; other code blocks within the #If...#EndIf construct would be ignored.
When a project is upgraded to Visual Basic .NET, only those blocks that evaluate to true will be upgraded; other code blocks within the #If...#EndIf construct will not be upgraded.
The following example shows a conditional block:
' Visual Basic 6.0 #If True Then Dim x As TextBox #Else Dim x As Label #End If ' After upgrade to Visual Basic .NET #If True Then Dim x As System.Windows.Forms.TextBox #Else ' UPGRADE_NOTE: #If #EndIf block was not upgraded because the expression Else did not evaluate to True. Dim x As Label #End If
What to do next
- Evaluate your project in Visual Basic 6.0 and make sure that the correct conditional compilation constants are being set. If you want to upgrade the code within a conditional block, remove it from the conditional block in Visual Basic 6.0, then add the conditional statements back after upgrading.