2
Answers

SaveFileDialog in C#

Arun Kurmi

Arun Kurmi

11y
1.3k
1
hi friends,How are you?

Today i want to know.....
how to use SaveFileDialog to save an image from windows form Application. I tried below code but there should be something wrong.
(i have an image on form in picturebox)
private void button2_Click(object sender, EventArgs e)
        {
            saveFileDialog1.ShowDialog();
        }

        private void saveFileDialog1_FileOk(object sender, CancelEventArgs e)
        {
            string name = saveFileDialog1.FileName;
            File.WriteAllText(name,pictureBox1.Image.ToString());
        }
Answers (2)