Note: You must be registered in order to post a reply.
|
Eric Coleman |
Posted - Jan 25 2005 : 10:33:21 PM I have the habit of using "On Local Error" for ignoring specific errors in certain subs and functions. However, it doesn't work. Well, it works like I expect it to, but the statement "On Error" doesn't.
Anyways, I tried looking up what the "Local" paramter means, but I can't find any mention of it in the VB help files. I looked at the VB keyword list and it's not listed.
I then thought that perhaps it's a relic from old VB, but I don't have any 16 Bit VB versions installed. I do have QBasic 1.0 and I checked, but no such luck in finding the history of "local."
So, my question, where does it come from and what does it do?
Download Attachment: vbgamer_error_test.zip 1.83 KB |
Almar |
Posted - Jan 27 2005 : 07:04:07 AM I've used it in YALG. There is a difference somehow. Sometimes I feel like Errors are going through the call stack. I can't explain, unfrotunatly, but sometimes the errors ended up somewhere else than were they really were :) |
Eric Coleman |
Posted - Jan 26 2005 : 08:05:05 AM If it's from earlier versions then I probably learned it from using VB 3. It's definitely not in QBasic or QuickBasic. And just for the record, I actually searched google and couldn't find anything. Thanks VBBR. |
VBBR |
Posted - Jan 26 2005 : 06:33:26 AM There's something here but it needs some subscription... http://accessvbsql.advisor.com/doc/10945
Search query I used (google): http://www.google.com.br/search?q=%28%22visual+basic%22+OR+vb%29+%22local+error%22+%22on+error%22
Now that's something interesting... from http://en.wikibooks.org/wiki/Programming:Visual_Basic#Error_Checking:
Private Sub Form_Load() On Error GoTo Label1 i = 1 / 0 Exit Sub Label1: MsgBox "Error Number " & Err.Number & ":" & Err.Description End Sub
The above example is the safest way of detecting and handling any error that takes place in the subroutine. However you can also choose to ignore errors by using "On Error Resume Next" and watch for errors in a certain line of code by using "On Local Error ..."
Hey wait, I found another one From http://www.mrexcel.com/archive2/44000/51072.htm: "Apparently there is no difference. The Local keyword is a holdover from earlier versions to make it easier to upgrade code. It is ignored in VB." |
|
|
VBGamer |
© |
|
|
|
|