Error Trapping and Error Line Number

G

Guest

I am using a try-catch-finally statement.

In my Catch clause, I trap an error and display the error with the .Message
property of the Exception class.

The problem is that I do not know which line within the code that the error
occurred?

I do not see a property that tells me that.

Does this mean that during the development process, I can not use the try -
catch statement? I do get a message with the line of the error when I do not
use the try catch statement.

TIA.
 
S

S. Justin Gengo

Paul,

Different parts of the exception display the line number.

During development I find it best to write the whole exception out when I
trap it with a try catch. So during development I always display ex.ToString



--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
G

Guest

Even when I print out the "entire" exception with a .tostring(), it still
does not list the line number?
 
H

Hans Kesting

Even when I print out the "entire" exception with a .tostring(), it still
does not list the line number?

Did you use it in DEBUG mode?
The linenumber is not shown in the exception message, but in the
stacktrace. Only is debug info is available.

Hans Kesting
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,280
Latest member
BGBBrock56

Latest Threads

Top