Problem about pictureBox in Visual Studio C Sharp.NET ?

Jun 25 2007 2:26 PM

Hi,

I am designing a paint brush type program…..for drawing area where I can draw something then I used pictureBox…..like as

                                Pen p = new Pen(Color.Red, 5);

                g = pictureBox2.CreateGraphics();

               

                g.DrawEllipse(p, e.X, e.Y, 5, 7);

in this program I can draw anything but when I want to save this drawing by the help of this command: pictureBox2.Image.Save(saveFileDialog1.FileName);

 

then an error occur : “NullReferenceExpection was unhandled !”

                      “Object reference not set to an instance of an object.”

 

I need your help………can anybody solve my problem

Thanks


Answers (3)