473,765 Members | 1,977 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1354
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**@discussio ns.microsoft.co m> wrote in message
news:78******** *************** ***********@mic rosoft.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
6615
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
10888
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. My biggest problem right now is that the error description associated with this error is Application-defined or object-defined error. It has always been my understanding that these error numbers would not be used by Microsoft and were available...
6
4753
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 appreciated. Thanks in advance
5
1812
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 to navigate to another record in the subform or main form, the Access default message comes up saying that the value is required, but in a very techincal way that the user will have no idea what it means. I tried putting a message on the OnError...
3
2747
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 that I can use instead? Cheers Nicolaas
4
9449
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 Err.Number = 2501 Then Exit Sub
13
4485
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 runs into problems on the system where it will actually be used, and since I used so little error-trapping it dies very ungracefully. I will of course try to fix whatever is causing the error and add error-trapping to the functions where the...
3
2043
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
19488
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 will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge. I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
0
2897
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 will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge. I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
0
9399
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10163
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10007
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9835
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7379
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5276
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.