|
-
Jul 20th, 2004, 03:20 AM
#1
Thread Starter
Lively Member
get compiled type
How can i get the compiled type, to show at runtime if the program is in release mode or in debug mode
thanks
-
Jul 20th, 2004, 04:29 AM
#2
I wish I could think of something witty to put in my sig...
...Currently using VS2013...
-
Jul 20th, 2004, 05:54 AM
#3
There is a built-in compilation constant called DEBUG
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles Button1.Click
#If DEBUG Then
MsgBox("Debug mode!")
#Else
MsgBox("Release mode!")
#End If
End Sub
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Jul 24th, 2004, 02:30 PM
#4
Thread Starter
Lively Member
?
What does thous # means before the if then else
-
Jul 24th, 2004, 02:33 PM
#5
Member
Re: ?
Originally posted by Antonio Begue
What does thous # means before the if then else
-
Jul 24th, 2004, 02:40 PM
#6
Thread Starter
Lively Member
?
#If DEBUG Then
MsgBox("Debug mode!")
#Else
MsgBox("Release mode!")
#End If
thous #
-
Jul 24th, 2004, 02:47 PM
#7
Its conditional compilation. The stuff in the #If section will only be compiled into the assembly if the condition or variable (DEBUG in this case) is defined and is True. Otherwise the code in the #Else portion is compiled in.
Try it for yourself...
VB Code:
#If QWERTY Then
MsgBox("Poop!")
#End If
Put that in the Load event of your form, and see if you see a msgbox. I bet you won't.
Then, put this at the top of your class...
and run it again. I'll bet you see the msgbox this time.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Jul 24th, 2004, 03:23 PM
#8
Thread Starter
Lively Member
ok but why this work #IF DEBUG then and this not if DEBUG then
and where can i get a list of constants like DEBUG
-
Jul 24th, 2004, 03:33 PM
#9
Member
Originally posted by Antonio Begue
ok but why this work #IF DEBUG then and this not if DEBUG then
and where can i get a list of constants like DEBUG
Now I understand! That's very cool... you learn something everyday.
When you write #If the intellisense takes over with a list of constants already defined.
-
Jul 24th, 2004, 03:39 PM
#10
Thread Starter
Lively Member
well I think it is not only that you get a pre defined constants list, I think that the false part does not get compiled so you reduce the runtime proces
-
Jul 24th, 2004, 05:31 PM
#11
Originally posted by crptcblade
There is a built-in compilation constant called DEBUG
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles Button1.Click
#If DEBUG Then
MsgBox("Debug mode!")
#Else
MsgBox("Release mode!")
#End If
End Sub
Cool, thanks. I've been looking for that.
This question was raised by Mr. Polite some time ago, and my only answer was the one above.
I had read about a constant but I have not been able to find it...until now, that is...thanks.
I wish I could think of something witty to put in my sig...
...Currently using VS2013...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|