Re: Err object spontaneously resetting

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Bob O`Bob (filterbob_at_yahoogroups.com)
Date: 10/21/04

  • Next message: Bob O`Bob: "Re: VB6 application crashing on win2k servers"
    Date: Thu, 21 Oct 2004 12:27:23 -0700
    
    

    Steve wrote:

    >>MyFunction_Err:
    >> If Err.Number = 5 Then
    >> ' Handle this error
    >> ElseIf Err.Number = -2147221486 Then
    >> ' Resume the code at a sensible point
    >> Else
    >> ' Do something else
    >> End If
    >>End Function
    >>
    >>So something happens to cause an error (in this case the DLL tries to
    >>retrieve an item from a collection that doesn't exist - the code is set-up to
    >>handle this, but the act of trying to retrieve the item causes the error),
    >>and the code correctly goes to the error handler. As soon as it does the
    >>first if statement the Err object resets itself, meaning that the second if
    >>that should have caught the error is by-passed and an error is raised
    >>unnecessarily.

    That's just not how VB works. There's no such thing as "by-passed"

    Maybe you're simply not getting the precise err.number that you coded.

    What's in the Else clause? Look THERE next. Make that "Do something
    else" include a log entry or report of some kind, or at the very least,
    a MsgBox.

            Bob

    -- 
    

  • Next message: Bob O`Bob: "Re: VB6 application crashing on win2k servers"

    Relevant Pages

    • Re: MKJC a thank you
      ... In fact, I wasn't even going to bother coming, until I heard Steve ... Steve, Stumpy & Pete were all very funny in the show, Neil's act has ... The bit about killing kids (or ...
      (rec.juggling)
    • Re: shadow copy in server
      ... Give it a try Steve. ... retrieve back, i will have to use the properties on the folder(parent ... recover deleted files since the original is no longer there ... The 'storage area' is also in d: ...
      (microsoft.public.windows.server.active_directory)
    • Re: SetMapMode
      ... second reason is because Steve has said that the window handle which is ... being passed to his dll is not necessarily the handle to a VB window. ... calling DLLs, they will use pixels. ...
      (microsoft.public.vb.general.discussion)
    • Re: Its not Whitley Bay its South Shields
      ... Just shows how young you really are Steve ... capitalised on the trend for Egyptian imagery following the discovery ... Their stage act, called the "sanddance". ... was a ludicrous parody of "egyptian" postures, combined with references ...
      (uk.local.geordie)
    • Re: Looking for an Autocomplete DropDownList
      ... Simply drag the DLL into your Visual Studio.NET toolbox. ... Steve C. Orr, MCSD, MVP ... > control in my toolbox. ... >> Steve C. Orr, MCSD, MVP ...
      (microsoft.public.dotnet.framework.aspnet.webcontrols)