472,331 Members | 1,608 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,331 software developers and data experts.

How to determine if you are debugging at runtime

Le
Hi

I would like to know if there was a way to know if you are running in debug or release mode at runtime for VB
This way I could execute certain code when debugging and execute something else in release

Thanks
Le
Jul 21 '05 #1
5 1553
You can use the [Conditional("DEBUG")] Attribute to determine this.
"Le" <an*******@discussions.microsoft.com> wrote in message
news:FC**********************************@microsof t.com...
Hi,

I would like to know if there was a way to know if you are running in debug or release mode at runtime for VB. This way I could execute certain code when debugging and execute something else in release.
Thanks,
Le

Jul 21 '05 #2
Le
Thanks for the reply William, but do you have an example of how to use it

Jul 21 '05 #3
create a function called whatever and add that attribute to it. inside it
call MesageBox.Show("Debug"). In main, call the function. If you build in
debug you'll see a messagebox,otherwise you wont.
[Conditional("Debug")]
private void whatever(){
MessageBox.Show("Debug");
}

in main or wherever, call whatever;
"Le" <an*******@discussions.microsoft.com> wrote in message
news:71**********************************@microsof t.com...
Thanks for the reply William, but do you have an example of how to use it.

Jul 21 '05 #4
Le
Thanks, that worked great
Is there a way to do this on a per line bases or sections of code inside a function or method

Jul 21 '05 #5
That method requires using attributes which must go on subs/functions
properties etc.

you can use your own compiler directiver #if "CONSTANTYOUDEFINED" Check out
Compiler Directives on Google.
"Le" <an*******@discussions.microsoft.com> wrote in message
news:D4**********************************@microsof t.com...
Thanks, that worked great!
Is there a way to do this on a per line bases or sections of code inside a function or method?

Jul 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Bob Bamberg | last post by:
Hello All, I have been trying without luck to get some information on debugging the Runtime Error R6025 - Pure Virtual Function Call. I am...
0
by: Gary Karasik | last post by:
Hi, One of my SBS 2K3 servers is giving the following errors when trying to run certain applications. Some Googling indicates that these are .Net...
6
by: Le | last post by:
Hi I would like to know if there was a way to know if you are running in debug or release mode at runtime for VB This way I could execute certain...
5
by: snicks | last post by:
I'm trying to exec a program external to my ASP.NET app using the following code. The external app is a VB.NET application. Dim sPPTOut As...
3
by: Developer in California | last post by:
I am working on developing a generic Web framework using Master Pages in ASP.NET 2.0. What I have done is created a PageRenderer class which has a...
1
by: mgonzales3 | last post by:
I have a windows app that i want to be able to run at the cmd line. Using vs2005 can I determine the Output Type at runtime? or can I set this...
5
by: phnimx | last post by:
Hi , We have developed a number of plug-in .NET Library Components that we typically deploy with our various applications by installing them into...
0
by: stimpy_cm | last post by:
Hi everyone, Iím not a programmer but have a little notion about how things work. I recently downloaded an emulator for my calculator (Texas...
0
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgRGVzYXJyb2xsbw==?= | last post by:
Hi misters, i have application winforms in VB.NET When I press F5, for executing Debug....it's slows... I see,
0
by: tammygombez | last post by:
Hey fellow JavaFX developers, I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.