Hi m trying to copy image file from one location to other as below in openDialog box C#.net
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
string filename = System.IO.Path.GetFileName(openFileDialog1.FileName);
string fname = Application.StartupPath + "\\Temp\\" + filename;
File.Copy(openFileDialog1.FileName, fname, true);
}
I get Exception as
Unknown software Exception(0xe0434f4d) ocurred in application at location 0x7c59bcb1
It works for all files except for .bmp file
Ne help for it?
Copying file error.
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
moraru matei5 pointsPosted Jun 23, 2008, 4:42 AM EDT
try to use
File.Copy(filename, fname, true)
File.copy syntax is File.Copy (string source_path, string destination_path, bool overwrite)
asma4 pointsPosted Jun 23, 2008, 4:48 AM EDT
I tried by changing the code...but the exception still occurs
moraru matei5 pointsPosted Jun 23, 2008, 5:04 AM EDT
OK, your code should look like this:
Now it should work (works for me).
1 short reply
asma4 pointsPosted Jun 23, 2008, 9:37 PM EDT