Pages

Monday, October 19, 2009

Problem while Saving modified .bmp file A generic error occurred in GDI+. C# .net By Praveen P.R

//Problem while Saving modified .bmp file
//A generic error occurred in GDI+.
//Do the following

//some function...... inside it.....
 try
  {
  System.GC.Collect();//imp
  System.GC.WaitForPendingFinalizers();//imp
  if (System.IO.File.Exists(Application.StartupPath + @"\Alpha100.bmp"))
  {
  System.IO.File.Delete(Application.StartupPath + @"\Alpha100.bmp");
  }
  myBitmap.Save(Application.StartupPath + @"\Alpha100.bmp");
  }
  catch (Exception ex)
  {
  MessageBox.Show(ex.ToString());
  }

No comments: