0
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
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
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
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
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
try
pictureBox1.Image.Save(fdlg.FileName);