joshuaand Posted December 1, 2003 Posted December 1, 2003 Hi, I am writing a little error Handler into all my subs and functions that will dump the error to a text file and continue, this is when the application is compiled and running on client machines. However I dont want to do that when I am debugging, I want to go to the line and debug as I normally would. So I have a couple of questions: 1.) Is there a way to tell if the application is running out of Visual Studio? 2.) Is there a way to pause the code when an error occurs: eg: Try 'My Code Goes Here Catch ex as exception if INVISUALSTUDIO then 'Pause Execution HERE to Do SOme Stuff end if ProcessError(Ex.Source, Ex.StackTrace, Ex.Message) end try Quote
Leaders Iceplug Posted December 1, 2003 Leaders Posted December 1, 2003 I think that there is a VB.NET Stop keyword that will send the execution to break mode in Visual Studio. 'The Stop keyword Stop Quote Iceplug, USN One of my coworkers thinks that I believe that drawing bullets is the most efficient way of drawing bullets. Whatever!!! :-(
iebidan Posted December 1, 2003 Posted December 1, 2003 You can always stop the execution of an app using the break mode of Visual Studio (normally a F9 key), there you can manage to see the values stored on variables, objects, threads, etc. Quote Fat kids are harder to kidnap
joshuaand Posted December 1, 2003 Author Posted December 1, 2003 If I do that I have to do it everywhere I have my try catch statement, not really an option! Quote
Leaders Iceplug Posted December 2, 2003 Leaders Posted December 2, 2003 And why not? You can automatically insert a Stop statement with the Visual Studio Replace. Replace: ProcessError with Stop: ProcessError and to revert it, replace: Stop: ProcessError with Process Error. :) Quote Iceplug, USN One of my coworkers thinks that I believe that drawing bullets is the most efficient way of drawing bullets. Whatever!!! :-(
*Experts* mutant Posted December 2, 2003 *Experts* Posted December 2, 2003 (edited) When compiling you can use the DEBUG compiler value. First you have to use the special If statement which is only read by the compiler. It looks like this: #If DEBUG Then 'do something if the program is compiled in DEBUG mode. #End If This kind of If statement will not be included in your program but rather the compiler will decide which code to compile based on the build configuration. To apply it to your program you would have to use DEBUG build for testing and RELEASE for distribution (which is the setup you should be using :D). It would look like this: Catch ex As Exception #If DEBUG Then Stop #Else 'Process the error #End If End Try Edited December 2, 2003 by mutant Quote
joshuaand Posted December 2, 2003 Author Posted December 2, 2003 Thanks Guys, Exactly what I was looking for, your help is very much appreciated!!!!! Thankyou Joshua Quote
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.