Is it possible to assign a value to a class variable from inside a #IF DEBUG conditional?
I want to conditionally execute some code from inside my main form load if I am running in DEBUG mode. I thought I could do something like:
Public Class Form1
public DEB as Integer
#if DEBUG then
DEB = 1
#else
DEB = 0
#end if
Private Sub Form1_Load(....)
if DEB=1 Then
<do something>
else
<do something else>
end if
....
However, it seems like you can’t assign a value to a variable. I’m obviously not understanding the scoping correctly. I can’t seem to put the #if DEBUG inside the Load sub routine. How do I do this?
Why not just test the compilation constant directly? You are not gaining anything by testing an actual variable.