|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Current namespace, stack and linenoHi everyone,
I'm relatively new to vb.net and am writing my errors object to collect errors as the call stack bounces back up to the GUI. When an error occurs, I would like to grab three things: 1. the line no the error occurred on 2. the current namespace. e.g. MyApplication.MyClass.MyFunction 3. the callstack. Does anyone know how to do this. Also, having transferred over recently from VB6, is there any way to query as in the immediate window of VB6 at runtime. Or for that matter, change the code at runtime (in the dev environment, obviously). Any information very gratefully received. Many thanks, Mark Roworth Hello markroworth,
Check out the StackTrace and Exception classes. -Boo Show quoteHide quote > Hi everyone, > > I'm relatively new to vb.net and am writing my errors object to > collect errors as the call stack bounces back up to the GUI. When an > error occurs, I would like to grab three things: > > 1. the line no the error occurred on > 2. the current namespace. e.g. MyApplication.MyClass.MyFunction > 3. the callstack. > Does anyone know how to do this. Also, having transferred over > recently from VB6, is there any way to query as in the immediate > window of VB6 at runtime. Or for that matter, change the code at > runtime (in the dev environment, obviously). > > Any information very gratefully received. Many thanks, > > Mark Roworth > markroworth wrote:
> When an error occurs, I would like to grab three things: Try> > 1. the line no the error occurred on > 2. the current namespace. e.g. MyApplication.MyClass.MyFunction > 3. the callstack. SomethingIffy() Catch ex As System.Exception Console.Writeline( ex.ToString() ) End Try The Exception class has lots of useful properties that you can use to pull the error apart (StackTrace and Message being the most useful). > is there any way to query as in the immediate window of VB6 There's an Immediate Window in Visual Basic ('2002, '2003 and '2005 - > at runtime. you didn't say which one you're using). > Or for that matter, change the code at runtime "Edit and Continue" is back in VB'2005 (for Console and Forms app's, anyway) but there have been /many/ reports of [*very*] poor performance when debugging with it switched on. That /may/ [have] improve[d] with SP1 (is that out yet?); I can't confirm/deny this. HTH, Phill W. Thanks guys, that's solved my problems.
Phill W. wrote: Show quoteHide quote > markroworth wrote: > > > When an error occurs, I would like to grab three things: > > > > 1. the line no the error occurred on > > 2. the current namespace. e.g. MyApplication.MyClass.MyFunction > > 3. the callstack. > > Try > SomethingIffy() > > Catch ex As System.Exception > Console.Writeline( ex.ToString() ) > > End Try > > The Exception class has lots of useful properties that you can use to > pull the error apart (StackTrace and Message being the most useful). > > > is there any way to query as in the immediate window of VB6 > > at runtime. > > There's an Immediate Window in Visual Basic ('2002, '2003 and '2005 - > you didn't say which one you're using). > > > Or for that matter, change the code at runtime > > "Edit and Continue" is back in VB'2005 (for Console and Forms app's, > anyway) but there have been /many/ reports of [*very*] poor performance > when debugging with it switched on. > That /may/ [have] improve[d] with SP1 (is that out yet?); I can't > confirm/deny this. > > HTH, > Phill W.
How to create a report (invoice)?
File operation with user-set wildcards Drag and Drop from Outlook to Vb.net RichTextBox DirectX rendered inside a control? problem save and reading from the registry Q: deleting relations Using SQLDataSource without a control? Problems with SaveAs How to make double click event to call and execute the mouseup event code Database |
|||||||||||||||||||||||