6
Answers

save a picturebox

annie_pollie07

annie_pollie07

20y
2.3k
1
hellow, I want to save a picture with every title of a movie. But if i use this: pictureBox1.Image.Save = System.Drawing.Image.FromFile(fdlg.FileName); it gives an error on the save What do i need to do? can somebody help me with this? thx and greetings
Answers (6)
0
kovan
NA 636 0 20y
you should be usign SaveFileDialog not OpenFileDialog to pick name of a image that u want to save but like steve said, pls include error message.
0
sjones
NA 135 0 20y
I didn't mean to delete the one you had in the Open method. I meant for you to add the same thing in the SAVE method. That is the one where you did not allow the user to actually select the file to save to.
0
annie_pollie07
NA 45 0 20y
hey, if I delete the if statement i can't open an image anymore. I'm stuck with this :'( thx for your help!!! greetings
0
sjones
NA 135 0 20y
A note to everyone that posts a message asking for help when getting an Error Message: PLEASE INCLUDE THE MESSAGE!!! That makes it a whole lot easier to pinpoint the problem and avoids the inevitable delay of someone responding only to ask "What message are you getting?" In this case I am going to guess that your problem is related to the fact that fdlg.FileName is null because you did not do the if(fdlg.ShowDialog() == DialogResult.OK) . Was I close?
0
annie_pollie07
NA 45 0 20y
hey thx for your help pictureBox1.Image.Save(fdlg.FileName); It accepts this line but now he gives an other error this is my whole code: private void cmdfiguur_Click(object sender, System.EventArgs e) { OpenFileDialog fdlg = new OpenFileDialog(); fdlg.Title = "C# Corner Open File Dialog" ; fdlg.InitialDirectory = @"c:\" ; fdlg.Filter = "All files (*.*)|*.*|All files (*.*)|*.*" ; fdlg.FilterIndex = 2 ; fdlg.RestoreDirectory = true ; if(fdlg.ShowDialog() == DialogResult.OK) { textBox3.Text = fdlg.FileName ; } PictureBox1.Image = System.Drawing.Image.FromFile(fdlg.FileName); } private void button1_Click(object sender, System.EventArgs e) { SaveFileDialog fdlg = new SaveFileDialog(); pictureBox1.Image.Save(fdlg.FileName); } Can you help me further with this please? thx
0
kovan
NA 636 0 20y
try pictureBox1.Image.Save(fdlg.FileName);