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.

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.


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


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

762 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