CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1

    Err.Raise - whats up with this?

    How do i propogate the error back to the calling function, and let that function handle it? I am using err.raise but for some reason its not handled in the calling function. It always results in runtime error. BTW, i have an error handler in the calling function.


    'function called
    public Function Add(objfav as clsFavorites, optional key as Variant) as clsFavorites
    'some details omitted for clarity
    on error GoTo raiseError
    'set the properties passed into the method
    mCol.Add objfav, key
    'return the object
    set Add = objfav
    Exit Function
    raiseError:
    Err.Raise Err.Number
    End Function






  2. #2
    Join Date
    May 1999
    Location
    Oxford UK
    Posts
    1,459

    Re: Err.Raise - whats up with this?

    You do have an 'On Error Goto ....' in the calling function don't you ?

    You'll have to post the code for the calling function as well, so we can see what's giving you problems.



    Chris Eastwood

    CodeGuru - the website for developers
    http://codeguru.developer.com/vb

  3. #3

    Re: Err.Raise - whats up with this?

    Is this happening in the IDE or in the executable.
    If it's in the IDE, make sure you don't have break on all errors checked in Tool | Options | General.

    Charles Zimmerman
    http://www.freevbcode.com
    mailto:[email protected]


  4. #4
    Join Date
    Sep 1999
    Location
    The Netherlands
    Posts
    5

    Re: Err.Raise - whats up with this?

    If your (called) function does not have an Error handler (no 'On Error ...' line) the error will allways be propagated to the calling function.



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

Featured