Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

How can check for debug mode in VB2010?

 

In VB2008 Express I could determine whether I was running the app from the debugger or the release version like this:

[Vb]

#If Debug Then

'My code here...

#Else

'Alternative code here...

#End If

[/Vb]

But in VB2010 Express this no longer works and when running my app from the VS IDE (F5) it always jumps to the else part.

Posted
The #If Debug Then statement will equal true at compile time if it is a debug build, this won't be effected by a debugger being attached or not.

But it seems like it never equals true.

 

The problem is that using the code below never shows the message box on my computer when using VB2010.

[Vb]

#If Debug Then

MsgBox("TESTING")

#End If

[/Vb]

  • Leaders
Posted
If you look under the "Compile" tab in the project properties, there is an "Advanced Compile Options..." button. In the window that comes up, there is a check box marked "Define DEBUG constant". As long as this is checked, I don't see why things shouldn't work as expected.
[sIGPIC]e[/sIGPIC]

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...