Conditionaly compile

  • Thread starter Thread starter Crirus
  • Start date Start date
C

Crirus

I need a code to be considered only when I test something...
How to declare a compile constant..?
 
You can use the built in Debug constant to test when compiled in to debug
mode instead of release mode.

E.g.

#If DEBUG Then

'Do debugging code

#End If

If you need to define your own constant, go to the project properties ->
Configuration Properties -> Build and insert any custom constants you need
at the bottom of the page.

Hope this helps.

Trev.
 
Found a better way

#const MyConst=True

..
..
..
#If MyConst Then

conditional code here

#EndIf
 
It might be handier than going through the project properties to set the
constant, but if you set it in the properties, you can specify different
values for different build configurations (e.g. DEBUG only exists in the
debug configuration, not the release configuration.
 
Back
Top