Conditionaly compile

C

Crirus

I need a code to be considered only when I test something...
How to declare a compile constant..?
 
C

Codemonkey

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.
 
C

Crirus

Found a better way

#const MyConst=True

..
..
..
#If MyConst Then

conditional code here

#EndIf
 
C

Codemonkey

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top