I have this:
strFileName which is an MS Word document's full path and name such as "c:\documents\myword.doc". So:
What I want to do is run the saveFileDialog and let the user create a new file name and save it out to their chosen location.
Here's what I'm trying, but it DOES NOT WORK:
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
saveFileDialog1.Filter = "doc files (*.doc)|*.doc";
saveFileDialog1.FilterIndex = 2 ;
saveFileDialog1.RestoreDirectory = true ;
if(saveFileDialog1.ShowDialog() == DialogResult.OK)
if((myStream = saveFileDialog1.OpenFile()) != null)
// (fromFile) file to copy from: strFileName
// (toFile) file to copy to: saveFileDialog1.FileName
FileInfo fromFile = new FileInfo(strFileName);
StreamReader myStreamReader = new StreamReader(fromFile.OpenRead());
FileInfo toFile = fromFile.CopyTo(saveFileDialog1.FileName, true);
What am I doing wrong? I'm creating a blank, zero-byte, word document. I can't seem to get the contents of the old word document to be saved out as the new one.