Unhandled Exception in GDI+ Part II

G

Guest

See my previous post about a slightly naughty animated gif giving the above
error message.

What is bad is that when this happens recovery is yucky at best.

I have the following in the appdomain unhandled exception handler.

Private Shared Sub AppDomainException(ByVal sender As Object,
ByVal t as System.UnhandledExceptionEventArgs)
ErrorHandler(t.ExceptionObject.ToString)
End Sub

Private Shared Sub ErrorHandler(ByVal msg As String)
Try
MsgBox(msg)
Catch ex As Exception
MsgBox("Problem in displaying error message" & vbCrLf &
ex.Message)
End Try
End Sub

PROBLEM / QUESTION: A good share of the time when the msgbox is displayed an
exception occurs and I get the second Msgbox. SUGGESTIONS PLEASE?

--
Regards,
Al Christoph
Senior Consultant
Three Bears Software, LLC
just right software @ just right prices @ 3bears.biz
Microsoft Certified Partner (ISV)
Coming soon: Windows Mail for Vista.
 
M

Michael C

Al Christoph said:
PROBLEM / QUESTION: A good share of the time when the msgbox is displayed
an
exception occurs and I get the second Msgbox. SUGGESTIONS PLEASE?

Keep a flag to indicate the messagebox is active and either don't show
another, kill the first, or wait for the first to go before displaying the
second. For a fault with an animated gif it would be better not to show the
error at all.

Michael
 
G

Guest

You are probably right about not showing the error at all:)

However if you look at my code snippet, you will see that it is the
traditional try catch block with a MODAL msgbox in the try part.

MS Lurkers take note: There is a ghost in the machine here. The exception
handling is occuring before the first msgbox has its ok button clicked!!!!!

So since there appears to be a ghost in the machine, I'll take your advice
and force the catch ex stuff to not display if the OK button hasn't been
pressed in the main dialog box.


--
Regards,
Al Christoph
Senior Consultant
Three Bears Software, LLC
just right software @ just right prices @ 3bears.biz
Microsoft Certified Partner (ISV)
Coming soon: Windows Mail for Vista.
 
L

Linda Liu [MSFT]

Hi Al,

In addition, I suggest that you use a custom form instead of MessageBox to
display the exception message.

You may keep a reference to the form instance when it is showing. When the
form is showing and another exception is catched, you could display the new
exception message as long as the previous exception on the form.

Hope this helps.


Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

Good suggestion. I'll be adding a custom msg form anyway to the project
because msgbox is sooooo lame. (As a minimum you should be able to copy and
paste the text!)
--
Regards,
Al Christoph
Senior Consultant
Three Bears Software, LLC
just right software @ just right prices @ 3bears.biz
Microsoft Certified Partner (ISV)
Coming soon: Windows Mail for Vista.
 

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

Top