Click here to Skip to main content
15,888,984 members
Home / Discussions / C#
   

C#

 
Questionc# help Pin
liveinweb2.08-Sep-09 8:14
liveinweb2.08-Sep-09 8:14 
AnswerRe: c# help Pin
dan!sh 8-Sep-09 8:29
professional dan!sh 8-Sep-09 8:29 
AnswerRe: c# help Pin
Christian Graus8-Sep-09 11:37
protectorChristian Graus8-Sep-09 11:37 
AnswerRe: c# help Pin
April Fans22-Sep-09 19:11
April Fans22-Sep-09 19:11 
Questionthanks Pin
tanweer8-Sep-09 6:47
tanweer8-Sep-09 6:47 
Questionrecord and play mp4 file Pin
Markandaiya Harsh8-Sep-09 6:27
Markandaiya Harsh8-Sep-09 6:27 
AnswerRe: record and play mp4 file Pin
Henry Minute8-Sep-09 10:57
Henry Minute8-Sep-09 10:57 
QuestionOverwrite an image Pin
vandel2128-Sep-09 5:55
vandel2128-Sep-09 5:55 
Hi, I'm currently using Visual c# 2008 express edition. I'm trying to save an image over a file with the same file name. When it attempts to do this is bombs out because it says either it's a generic GDI+ error or the process is already in use. This makes perfect sense why it would throw those errors, but how can I overwrite the file so that it doesn't give me this problem. I've tried Opening a file stream around it then closeing it. useing the bmpPicture.Dispose(), and GC.Collect(), none of those work.Is there something else I could try? or perhaps something I'm doing wrong?

here is a snippet of my code:

<br />
private void SaveFile()<br />
        {<br />
                // Set the bitmap object to the size of the screen<br />
                bmpPicture = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb);<br />
                // Create a graphics object from the bitmap<br />
                gfxScreenShot = Graphics.FromImage(bmpPicture);<br />
                // Take the screenshot from the upper left corner to the right bottom corner<br />
                gfxScreenShot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y + 25, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);<br />
                // Save the screenshot to the specified path that the user has chosen                 <br />
                bmpPicture.Save(FilePath, ImageFormat.Bmp); //****THIS IS WHERE THE ERROR IS THROWN****<br />
        }<br />

AnswerRe: Overwrite an image [modified] Pin
Luc Pattyn8-Sep-09 6:08
sitebuilderLuc Pattyn8-Sep-09 6:08 
GeneralRe: Overwrite an image Pin
harold aptroot8-Sep-09 6:10
harold aptroot8-Sep-09 6:10 
AnswerRe: Overwrite an image Pin
Luc Pattyn8-Sep-09 7:58
sitebuilderLuc Pattyn8-Sep-09 7:58 
QuestionTaking a snapshot from a local webcam... Pin
to_aru_shiroi_neko8-Sep-09 5:37
to_aru_shiroi_neko8-Sep-09 5:37 
QuestionWorking with very large numbers. Pin
JTKRIST8-Sep-09 5:13
JTKRIST8-Sep-09 5:13 
AnswerRe: Working with very large numbers. Pin
Luc Pattyn8-Sep-09 5:22
sitebuilderLuc Pattyn8-Sep-09 5:22 
AnswerRe: Working with very large numbers. Pin
Richard MacCutchan8-Sep-09 5:26
mveRichard MacCutchan8-Sep-09 5:26 
AnswerRe: Working with very large numbers. Pin
harold aptroot8-Sep-09 5:39
harold aptroot8-Sep-09 5:39 
AnswerRe: Working with very large numbers. Pin
DaveyM698-Sep-09 5:40
professionalDaveyM698-Sep-09 5:40 
QuestionHow to notify all instance of a class that a change is happened Pin
Nitheesh George8-Sep-09 4:48
Nitheesh George8-Sep-09 4:48 
AnswerRe: How to notify all instance of a class that a change is happened Pin
monstale8-Sep-09 5:16
monstale8-Sep-09 5:16 
Questioncompile Pin
sanforjackass8-Sep-09 4:27
sanforjackass8-Sep-09 4:27 
AnswerRe: compile Pin
stancrm8-Sep-09 4:30
stancrm8-Sep-09 4:30 
AnswerRe: compile Pin
Manas Bhardwaj8-Sep-09 4:39
professionalManas Bhardwaj8-Sep-09 4:39 
Questionis there any way to create a new Process from a Stream? [modified] Pin
Demasoni8-Sep-09 3:51
Demasoni8-Sep-09 3:51 
GeneralRe: is there any way to create a new Process from a Stream? Pin
harold aptroot8-Sep-09 3:55
harold aptroot8-Sep-09 3:55 
QuestionRe: is there any way to create a new Process from a Stream? Pin
OriginalGriff8-Sep-09 3:56
mveOriginalGriff8-Sep-09 3:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.