Hi. I made this program to capture the current screen in C#. In Visual Studio 2008, it worked perfectly, but now with VS 2010, I get the following exception: ExternalException - a generic error occured in GDI+ on the line where I save the bitmap:


I have looked everywhere on the Net, but it's always suggested that the problem is in the code. Well it isn't, the code works fine in VS 2008.

I found the problem.
I was using bmp.Save("screens\\screen" + n + ".jpg");
(screens is a non-existing folder to be created)
but when I changed it to bmp.Save("screen" + n + ".jpg"); it worked.

When I used this:
bmp.Save("screens\\screen" + n + ".jpg");
it also worked.

Please mark this thread as solved if you have found an answer to your question and good luck!