[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now


Error during Debug of application - GDI+ is not properly initialized

Posted on 2004-07-30
Medium Priority
Last Modified: 2008-01-09
I have a VB.Net client application.  When I run it in debug mode it works fine but when I go to exit the application to get out of debug and back to the development screen I get this error:

An unhandled exception of type 'System.Runtime.InteropServices.ExternalException' occurred in system.drawing.dll

Additional information: Internal error: GDI+ is not properly initialized.

I looked around the web and saw something that indicated that any file serialization "Close" calls needed to be removed.  This does not make sense to me since I do not have a file open during development.

Any help would be GREATLY appreciated,

Question by:HAMMER33333
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3

Expert Comment

ID: 11677863
its not talking about closing a file, but closing an object.  can you post your code?

Author Comment

ID: 11679635
It is proprietary so I can't post the code.  Also it is a large amount of code.

However, you do put me onto a great idea.  I will check around at the objects.  What sort of object would this be?  A form, connection to a database, a webservice?

I am basically running the App in debug mode, clicking on the "x" in the upper right hand corner to close it down and I get this error.  If I click "Continue" when the error comes up it brings me back to my .Net developer solution screen.

Thanks for the help,


Expert Comment

ID: 11679828
this website makes a lot of sense of the situation


i think what you have is someone rendering a drawing surface.  

what could possibly happen is they have a handled exception at initialization (for instance if the .bmp file does not exist, dont initialize) then when the close call comes, the program never opened it, so it returns your error.

thats one possibility, it could be a few different reasons why youre getting your error.

is this professionally written software?  if so, id get a hold of the company.  if this is written by someone you know, get a hold of them and tell them to look into this error.

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 11679877
I can show you the below code.  The program starts by running the module "ModuleDeclareForms".  The FfrmMain is created and displayed to the user in the "main" routine below.  I ran the debugger on this and when the user clicks the "x" in the upper right hand corner the code the code drops out of the "FfrmMain.ShowDialog()" goes to the "End Sub" and shortly after that the error appears.  Is there some other ending an application?

Thanks again,

Module ModuleDeclareForms

    Public FfrmMain As New frmMain()
    Public FfrmLogin As New frmLogin
    Public FfrmGetEmail As New frmGetEmail()
    Public FfrmAgentState As New frmAgentState()
    Public FfrmAbout As New frmAbout()
    Public FfrmClose As New frmClose
    Public FfrmSuspended As New frmSuspended()
    Public FfrmAgentProperties As New frmAgentProperties

    Sub main()


     End Sub

End Module

Author Comment

ID: 11694813

       How do you find something like that?   I have tried Try/Catch, looking for GDI instances, bad file names, and cannot find anything.  We are using the new Component One icons.  Could that have anything to do with it?

Thanks again,



Accepted Solution

bramsquad earned 800 total points
ID: 11787703
sorry this took me a while....

well your problem has nothing to do with the above code.  the error in question is in an event handler within the main form.  

ive never figured out why, but i know that combo boxes trigger the "SelectedIndexChanged" event before even the form_load event! -- you should try it, create a test app with a combo box and put msgbox("hello") in that event

where im going with this, is that on close there might be an event that gets activated somewhere....other than that, i really dont know what better direction to point you in.

best of luck, let me know if you have any more problems i can help with


Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question