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?



asmaPosted Jun 24, 2008, 1:37 AM
moraru mateiPosted Jun 23, 2008, 9:04 AM
OK, your code should look like this:
if
(openFileDialog1.ShowDialog() == DialogResult.OK){
string filename = System.IO.Path.GetFileName(openFileDialog1.FileName);
string fname = Application.StartupPath + "\\" + filename;
File.Copy (openFileDialog1.FileName.ToString(), fname, true);
}
Now it should work (works for me).
asmaPosted Jun 23, 2008, 8:48 AM
I tried by changing the code...but the exception still occurs
moraru mateiPosted Jun 23, 2008, 8:42 AM
try to use
File.Copy(filename, fname, true)
File.copy syntax is File.Copy (string source_path, string destination_path, bool overwrite)