JumpyNET Posted August 21, 2011 Posted August 21, 2011 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. Quote
Administrators PlausiblyDamp Posted August 21, 2011 Administrators Posted August 21, 2011 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. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
JumpyNET Posted August 21, 2011 Author Posted August 21, 2011 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] Quote
JumpyNET Posted August 21, 2011 Author Posted August 21, 2011 I tried the same with a brand new project and there it seems to work. The problem must be related to converting the original VB2008 project to VB2010. Quote
Leaders snarfblam Posted August 22, 2011 Leaders Posted August 22, 2011 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. Quote [sIGPIC]e[/sIGPIC]
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.