473,395 Members | 1,937 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 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 1616
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 working in C++ and have only one class that is derived...
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 Framework errors. I've tried reapplying .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 code when debugging and execute something else in...
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 String sPPTOut = MDEPDirStr + sID + ".ppt" Dim p 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 public method which will retrieve the path of the...
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 value at runtime? thanks
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 the GAC. Each of the applications contains an...
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 Instruments Voyage 200), the program uses a library...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.