The error could be in the class you are using. A quick fix is to use Try...Catch blocks and show the user and error message if an exception occurs.
Main Topics
Browse All TopicsHi Experts
Im having intermittent trouble saving a BitMap. Every so often, my program stops at the marked line and reports: ExternalException was unhandled.
How can I cure this please ?
TIA, Patrick
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
m_BMWork.Save(FileName, ImageFormat.Bmp) <- stops here
If you are getting an error here, then either the filename already exists or your app may not have permission to write to that particular location.
If it already exists, then the link that I posted will show you how to overwrite the file. If its a permission problem, you will need to post more info.
My point is that Bitmap.Save *will not* overwrite a file, you have to use a different object to do that.
Thanks ladarling
Please accept my apologies for saying your link didn't seem relevant - I missed the mportant bit at the bottom that was, AIUI, intended to cope with:
"Bitmap.Save will not overwrite a file, you have to use a different object to do that
More info: I am writing (yet another) image editor. Now my program can cope if, for example, I try to save a bitmap as "myimage.bmp" that already exists
However, .NET barfs if try to save "myimage.bmp if I had first loaded it to work on. Its message is: "The process cannot access the file .... because it is being used by another process.
I attach my FileSave code. Any suggestions ?
TIA Patrick
Business Accounts
Answer for Membership
by: ladarlingPosted on 2009-09-09 at 09:12:43ID: 25292756
Does the debugger give you any details about the exception?
It may be that your bitmap already exists at the specified destination... The bitmap object does not allow overwriting, so you would need to use the IO namespace.
See my example here:
http://www.experts-ex change.com /Web_Devel opment/Ima ges/Q_2470 8296.html