#If MyVar > 5 Then ' or the value of some Boolean is True, etc.
' Do something (or any number of things)
#Else
' Do something else
#End If
#If Testing Then
picSmilie(0).Visible = True
picSmilie(picSmilie.Count - 1).Top = picSmilie(picSmilie.Count - 2).Top - 40
picSmilie(picSmilie.Count - 1).Visible = True
#End If
Public Sub DoNotAllowTestCodeToCompile()
#If Testing Then
Do not compile
#End If
End Sub
For example, to create French language and German language versions of the same application from the same source code, embed platform-specific code segments in #If...Then statements using the predefined constants conFrenchVersion and conGermanVersion.
#If conFrenchVersion Then
' <code specific to the French language version>.
#ElseIf conGermanVersion then
' <code specific to the German language version>.
#Else
' <code specific to other versions>.
#End If
If the value of the conFrenchVersion constant is set to True at compile time, the conditional code for the French language version will be compiled. If the value of the conGermanVersion constant is set to True, the compiler uses the German language version.
If you find that this article has been helpful, please click the “thumb’s up” button below. Doing so lets me know what is valuable for EE members and provides direction for future articles. It also provides me with positive feedback in the form of a few points. Thanks!
Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.
Comments (0)