Post

 Resources 

Console

Home | Profile | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 VBGamer
 VBGamer
 Error and Local Error
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Eric Coleman
Gladiator

USA
811 Posts

Posted - Jan 25 2005 :  10:33:21 PM  Show Profile  Visit Eric Coleman's Homepage  Reply with Quote
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

VBBR
Moderator

Brazil
617 Posts

Posted - Jan 26 2005 :  06:33:26 AM  Show Profile  Reply with Quote
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  
             '...  
             'Some code  
             Exit Sub
      Label1:  
             'Handles the error  
             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."


Whatever. Who knows...

Edited by - VBBR on Jan 26 2005 06:38:53 AM
Go to Top of Page

Eric Coleman
Gladiator

USA
811 Posts

Posted - Jan 26 2005 :  08:05:05 AM  Show Profile  Visit Eric Coleman's Homepage  Reply with Quote
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.
Go to Top of Page

Almar
Moderator

Netherlands
192 Posts

Posted - Jan 27 2005 :  07:04:07 AM  Show Profile  Visit Almar's Homepage  Send Almar an ICQ Message  Reply with Quote
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 :)
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
VBGamer © Go To Top Of Page
This page was generated in 0.12 seconds. Snitz Forums 2000

Copyright © 2002 - 2004 Eric Coleman, Peter Kuchnio , et. al.