473,396 Members | 2,061 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,396 software developers and data experts.

Error Trapping and Error Line Number

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.
Nov 19 '05 #1
3 1339
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
"Paul" <Pa**@discussions.microsoft.com> wrote in message
news:78**********************************@microsof t.com...
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.

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

"Paul" wrote:
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.

Nov 19 '05 #3
> 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



"Paul" wrote:
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.

Nov 19 '05 #4

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

Similar topics

13
by: deko | last post by:
I use this convention frequently: Exit_Here: Exit Sub HandleErr: Select Case Err.Number Case 3163 Resume Next Case 3376 Resume Next
9
by: Robert Wing | last post by:
I support an MS Access application in which errors are trapped using the On Error statement. Just recently, the users of this system have experienced run-time error number 3021 on a random basis. ...
6
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
5
by: Paul | last post by:
Please help if you can. I have a subform with a field on it that is set to have a required value. The problem is that when the user does not fill out all the appropriate information and tries...
3
by: windandwaves | last post by:
Hi Gurus Does anyone know how I set the error trapping to option 2 in visual basic. I know that you can go to tools, options and then choose on unhandled errors only, but is there a VB command...
4
by: Keith | last post by:
I have the following code in the On No Data event of a report: **** On Error GoTo err_trap MsgBox "No items matching criteria.", vbInformation, gcApplication Cancel = True err_trap: If...
13
by: Thelma Lubkin | last post by:
I use code extensively; I probably overuse it. But I've been using error trapping very sparingly, and now I've been trapped by that. A form that works for me on the system I'm using, apparently...
3
by: Smriti Dev | last post by:
Hi There, I have the following code and when I try to run it, I get a type mismatch error. I would really appreciate your help with this. Thanks kindly, smriti --- Private Sub cmdOK_Click()
2
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.