Results 1 to 6 of 6

Thread: Local error

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2002
    Posts
    9

    Local error

    Is there a difference between the following two lines:

    On Error Goto ErrorHandler

    and

    On Local Error Goto ErrorHandler

    I can't find any documentation on it, but I assume there is some reason for the inclusion of the Local keyword in the examples I've seen.

  2. #2
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    On Error Statement Syntax

    On Error GoTo line

    On Error Resume Next

    On Error GoTo 0
    That ones straight out of the MSDN helpfiles, I guess the local bit could be left over as a compatibility issue if earlier versions of vb supported it, but it looks like your better off doing without it now.

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  3. #3

    Thread Starter
    New Member
    Join Date
    Jun 2002
    Posts
    9
    I'm not looking for a better way of doing things, just wondering if there was any distinction made between the syntax. eg. the error handler does not come into effect in case of a DLL error.

    It would be useful..!

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    Alex is completely correct. On Local Error Blah Blah was used in older, DOS based version of the Basic programming language. I didn't even know it was still supported.

    Ignore it. Don't use it. One day it won't be supported anymore (I would be surprized if .NET supports it)

  5. #5
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    Cool that makes a nice change!

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  6. #6
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    the error object has err.lastdllerror... maybe that can help you if you are looking to determine if errors are from a dll you are using.. here is what MSDN has to say

    The LastDLLError property applies only to DLL calls made from Visual Basic code. When such a call is made, the called function usually returns a code indicating success or failure, and the LastDLLError property is filled. Check the documentation for the DLL's functions to determine the return values that indicate success or failure. Whenever the failure code is returned, the Visual Basic application should immediately check the LastDLLError property. No exception is raised when the LastDLLError property is set.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width