Cannot Handle Exception

  • Thread starter Thread starter elziko
  • Start date Start date
E

elziko

I have a procedure that creates a bitmap of a certain size and then displays
it in a 3rd party component.

However, if the bitmap is very large then a System.OutOfMemoryException is
thrown my something but my codes breaks at the difition of my class:

"Public Class MainForm"

....so I'm assuming that the OutOfMemoryException occurs in the 3rd party
since I have put a Try-Catch block around my bitmap creation code and I am
unable to catch the error there. There is not other code run after this.

If the bitmap is too big then thats fine, but I **need** to handle the
exception. Is there any way of catching this exception and getting more
information about what threw it? Did I read something about some kind of
application level exception handling in VS2005? I can;t find any info about
it now!

TIA
 
Hi,

Open my project and check the enable application framework check
box in the application tab. Click view application events button which will
open applicationevents.vb. In the combobox on the top left select
myapplication events. In the box on the right select unhandledException.


Namespace My

' The following events are availble for MyApplication:
'
' Startup: Raised when the application starts, before the startup form
is created.
' Shutdown: Raised after all application forms are closed. This event
is not raised if the application terminates abnormally.
' UnhandledException: Raised if the application encounters an unhandled
exception.
' StartupNextInstance: Raised when launching a single-instance
application and the application is already active.
' NetworkAvailabilityChanged: Raised when the network connection is
connected or disconnected.
Partial Friend Class MyApplication

Private Sub MyApplication_UnhandledException(ByVal sender As Object,
ByVal e As
Microsoft.VisualBasic.ApplicationServices.UnhandledExceptionEventArgs)
Handles Me.UnhandledException

End Sub
End Class

End Namespace


Ken
 
Private Sub MyApplication_UnhandledException(ByVal sender As
Object, ByVal e As
Microsoft.VisualBasic.ApplicationServices.UnhandledExceptionEventArgs)
Handles Me.UnhandledException

Yeah thats what I was looking for! However, this exception isn't passed to
the handler. Any ideas why this may happen?

TIA
 
Hi,

Maybe contact the maker of the third party control to see if they
have an update.

Ken
---------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top