|
-
Aug 7th, 2000, 07:00 AM
#1
Thread Starter
Addicted Member
Hi,
I am using "On Error GoTo ErrorHandler", Is there a way to find out in exactly in What command the error has occured?
The line number?
Regards
-
Aug 7th, 2000, 07:09 AM
#2
Hyperactive Member
Hello Tiovital,
I allways removing temporary the "On Error" statement.
Lets happen the situation where the error occures. Vb will show you the error line.
Michelle.
-
Aug 7th, 2000, 07:13 AM
#3
Addicted Member
I use the following to 'break in' to the code on an error. Insert a zero and comment out the handler Label.
On Error GoTo 0 'Error_handler
Then when I'm done, I delete the (0 ') and use my error handler.
-
Aug 7th, 2000, 07:26 AM
#4
You can find the description of an Error, use the Err object and track it down judging by what each statement does.
Code:
On Error GoTo ErrorHandler
'Generate an Error
Err.Raise 6
Exit Sub
ErrorHandler:
'Display a MessageBox with a description of the Error
MsgBox Err.Description
-
Aug 7th, 2000, 11:21 PM
#5
Thread Starter
Addicted Member
Hi,
Thanks for the info, But i know all that, I just want to know if there is a method to know - in run time - the problematic line, Thats all.
Regards
-
Aug 8th, 2000, 12:51 AM
#6
Tiovital, VB automatically select the line in which the error occured, as Michelle said.
And Megatron's way should tell you what error it was that occurred. If you want to know the number of the error the occured, than use Err.Number.
Code:
On Error GoTo ErrorHandler
Error 6
Exit Sub
ErrorHandler:
MsgBox "Error " & Err.Number & Chr(58) & Chr(32) & Err.Description
[Edited by Matthew Gates on 08-08-2000 at 01:55 AM]
-
Aug 8th, 2000, 01:35 AM
#7
Thread Starter
Addicted Member
Matthew,
Can You tell What line-number Faild? What instracution number failed? (not the err.number)
-
Aug 8th, 2000, 07:38 AM
#8
transcendental analytic
Using Labels you can determine the error line on which error was caused
Code:
Private Sub Form_Load()
On Error Resume Next
15: Err.Raise 10
MsgBox Erl
End Sub
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|