Results 1 to 9 of 9

Thread: Application Error

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2006
    Posts
    11

    Application Error

    I use try and catch to catch unexpected errors in my applications. But I cannot catch those "application error"-messages that appear when the program tries to write in forbitten memory locations.

    Is there a way to catch them?

  2. #2
    Hyperactive Member josep's Avatar
    Join Date
    Sep 2006
    Location
    Barcelona
    Posts
    409

    Re: Application Error

    Hi,

    Quote Originally Posted by tobiaswalter
    when the program tries to write in forbitten memory locations.
    The program does not try to write in fordiden memory locations.... by itself

    Do you have some code to show us?
    Useful links:DB connection strings ADO.NET VB.NET Tutorials

    • Don't forget to close the thread if solved
    • If this post helps you rate it

  3. #3

    Thread Starter
    New Member
    Join Date
    Sep 2006
    Posts
    11

    Re: Application Error

    Unfortunately not, because the error comes from an ActiveX-Com-Control I use in my .net-code.
    However, I'm not trying to find this special error - I'm looking for a way to catch those type of errors.

  4. #4
    Hyperactive Member josep's Avatar
    Join Date
    Sep 2006
    Location
    Barcelona
    Posts
    409

    Re: Application Error

    humm

    So the error is inside an Activex-COM control. I suppose yo tried with
    VB Code:
    1. try
    2.   yourdll.youmethod
    3. catch ex as exception
    4.   '....
    5. end try

    and it did not work

    Also I suppose this control works fine with VB 6.

    So there is something i got from .net help

    [/QUOTE]Visual Studio .NET usually does a good job of creating interop assemblies, but sometimes you need to optimize the code it generates. Problems with interop assemblies occur because type libraries do not always have all the necessary information to handle some kinds of data marshaling. If an interop assembly does not seem to work correctly, or if you notice performance problems when accessing a COM object using an interop assembly, you may need to manually edit the interop assembly to specify data marshaling. The ability to modify interop assemblies also makes it possible to call methods that are not compatible with OLE automation and that cannot be called using Visual Basic 6.0.
    [/QUOTE]

    search for Troubleshooting .NET Interoperability on the help you will find the full technical article

    Hope this helps
    Useful links:DB connection strings ADO.NET VB.NET Tutorials

    • Don't forget to close the thread if solved
    • If this post helps you rate it

  5. #5

    Thread Starter
    New Member
    Join Date
    Sep 2006
    Posts
    11

    Re: Application Error

    Thank you for your reply.
    I tried the try-catch-block, yes.
    My intention is not to fix this special error, but to be able to catch all the errors of this type. The error I described is just an example which causes such an error I want to catch.
    With try-catch, I cannot 'hold' this error within my application and handle it there - the user notices this error. And this is it, which I would like to suppress

  6. #6
    Hyperactive Member josep's Avatar
    Join Date
    Sep 2006
    Location
    Barcelona
    Posts
    409

    Re: Application Error

    This happens because the error happens inside the control and as far as i know .net does not have control on it.

    So the only way I Know to skip this error is try to do it inside the interop file that .net creates to allow use of this COM controls
    Useful links:DB connection strings ADO.NET VB.NET Tutorials

    • Don't forget to close the thread if solved
    • If this post helps you rate it

  7. #7
    Hyperactive Member
    Join Date
    May 2006
    Posts
    426

    Re: Application Error

    .NET still supports the old Error handling techniques where you create a function in a function and use it when there is an error.
    Try using
    VB Code:
    1. On Error GoTo Err_Trapper
    2.  
    3. Err_Trapper:
    4.         If Err.Number = YourErrorNumber Then
    5.          'Display Message
    6.             Exit Sub
    7.         End If

  8. #8

    Thread Starter
    New Member
    Join Date
    Sep 2006
    Posts
    11

    Re: Application Error

    no, On Error didn't works either

  9. #9
    Hyperactive Member
    Join Date
    May 2006
    Posts
    426

    Re: Application Error

    You need to Know the erroe you are trying to handle then you handle it.
    Maybe its number, descrpition, type...etc

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