|
-
Oct 4th, 2006, 04:48 AM
#1
Thread Starter
New Member
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?
-
Oct 4th, 2006, 04:53 AM
#2
Hyperactive Member
Re: Application Error
Hi,
 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?
-
Oct 4th, 2006, 05:10 AM
#3
Thread Starter
New Member
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.
-
Oct 4th, 2006, 05:27 AM
#4
Hyperactive Member
Re: Application Error
humm
So the error is inside an Activex-COM control. I suppose yo tried with
VB Code:
try
yourdll.youmethod
catch ex as exception
'....
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
-
Oct 4th, 2006, 05:37 AM
#5
Thread Starter
New Member
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
-
Oct 4th, 2006, 05:40 AM
#6
Hyperactive Member
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
-
Oct 4th, 2006, 05:52 AM
#7
Hyperactive Member
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:
On Error GoTo Err_Trapper
Err_Trapper:
If Err.Number = YourErrorNumber Then
'Display Message
Exit Sub
End If
-
Oct 4th, 2006, 06:16 AM
#8
Thread Starter
New Member
Re: Application Error
no, On Error didn't works either
-
Oct 4th, 2006, 06:55 AM
#9
Hyperactive Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|