private void buttonSaveXML_Click(object sender, EventArgs e)
{
SaveFileDialog saveFile = new SaveFileDialog();
saveFile.Filter = "XML Files|*.xml";
saveFile.Title = "Save a Xml File";
saveFile.InitialDirectory = @"C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\fxo\NewVersion";
textBoxTargetFolder.Text = @"C:\Program Files (x86)\EdisonFactory\NetOffice";
saveFile.ShowDialog();
if (saveFile.FileName != "")
{
FileStream fs = (FileStream)saveFile.OpenFile();
dsVersions.WriteXml(fs);
}
string sourceFileFolder = @"C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\fxo\NewVersion";
string destinationFileFolder = @"C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\fxo\NewVersion";
bool overwrite = true;
File.Copy(sourceFileFolder, destinationFileFolder);
{
overwrite = true;
}
我做了这么多,但我不知道我错过了什么。有什么帮助吗?该按钮保存 XML,但它还需要从所选文件中获取文件并将它们复制/粘贴到 xml 文件保存的位置。File.Copy(sourceFileFolder, destinationFileFolder);
我需要复制的方式也有一个例外,即从一个文本框中获取路径并将其从路径粘贴到另一个文本框中。