|
-
Nov 28th, 2000, 02:09 AM
#1
Thread Starter
Lively Member
Is it possible to view in run time the program line which result error. Something like this:
Code:
Private Sub Command1_Click()
On Error GoTo err_handler
Open "c:\data\some_text.txt" For Input As #1
'that file doesn't exists, so program jump to err_handler
err_handler:
If Err.Number = 76 Then
MsgBox "Error: " & Err.Number & " " & Err.Description
End If
End Sub
This code generates error. I want to see
Open "c:\data\some_text.txt" For Input As #1
in my msgbox or write it in log file.
Or is there some other way?
Why I need this? I wrote program for another company which distribute it to their customers. But unfortunately they are not computers programmers like me (even ordinary computers users knows more than employees in this company) and I have hard time to understand them if there is an error in program.
Program is quite complex and many conditions must be meet for program to work properly (user must prepare those conditions) so I don’t wanna discus about error handling!
I just wanna the last line of code in log file (code that generates error).
Thnx for your help!
Ermin
Ermin Gutenberger
VB.NET 2010
-
Nov 28th, 2000, 03:15 AM
#2
transcendental analytic
Not directly but you can retrieve the error line number using erl
Code:
Private Sub Command1_Click()
On Error GoTo err_handler
10: Open "c:\data\some_text.txt" For Input As #1
'that file doesn't exists, so program jump to err_handler
err_handler:
If Err.Number = 76 Then
MsgBox "Error line number: " & ERL
End If
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.
-
Nov 28th, 2000, 04:55 AM
#3
PowerPoster
Auto insert line number.
Hi! Kedaman, It is possible that VB itself insert all the reference line number into the source code, so that when an unexpected error occur we can call the Erl object to return the line number that encounter error.
Else, it'll be very painful for those wish to use this object yet does not make sense for the Erl object itself.
-
Nov 28th, 2000, 12:54 PM
#4
Thread Starter
Lively Member
Thanks for your answer. Now my program looks like basic program on old Commodore computer, but it works.
If U have any other suggestion, fell fre to replay!
Ermin
Ermin Gutenberger
VB.NET 2010
-
Nov 28th, 2000, 02:21 PM
#5
transcendental analytic
Hehe, the line number sure looks ugly but it doesn't mean theres any loss in performance 
I'm not sure but i think ERL is part of Err object, it doesn't appear anywhere at all not even object browser, i just happened to discover it since it existed in qbasic.
Nope, Vb doesn't put these line numbers by it self, either you have to do it or, make an add-in that does it for you.
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.
-
Nov 28th, 2000, 08:09 PM
#6
PowerPoster
Em... do you wrote any VB Add-in before? If yes, Can share some of your knowledge in writing VB Add-in?
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
|