雖然我指定了不同的位置,但文件被保存在mydocuments中。如何解決這個問題。請分享你的想法,如果有的話。這裏是代碼。文件沒有保存在winforms中的指定位置c#
if (externalButton.Checked == true)
{
// int i = 1;
saveFileDialog.Title = "Save the Proofer Report";
saveFileDialog.Filter = "Document Files (*.doc)|*.doc|Document Files (*.docx)|*.docx";
saveFileDialog.FilterIndex = 0;
saveFileDialog.InitialDirectory = "MyDocuments";
saveFileDialog.FileName = "Proofer Report -- " + Path.GetFileName((string)fileName) + ".doc";
//i.tostring()
saveFileDialog.DefaultExt = ".doc";
saveFileDialog.ShowHelp = true;
// saveFileDialog.ShowDialog();
var thread = new Thread(new ParameterizedThreadStart(param => { saveFileDialog.ShowDialog(); }));
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
fname = saveFileDialog.FileName;
爲什麼線? – BlueChippy 2013-02-13 06:39:40
正在使用不同的線程,因爲我得到「當前線程必須設置爲單線程單元(STA)模式之前可以進行OLE調用」錯誤 – user1665707 2013-02-13 10:25:48