0
我也許做了一些勉強的事,但看不到它是什麼!拖放複製文件
string pegasusKey = @"HKEY_LOCAL_MACHINE\SOFTWARE\Pegasus\";
string opera2ServerPath = @"Server VFP\";
string opera3ServerPath = @"O3 Client VFP\";
string opera2InstallationPath = null;
string opera3InstallationPath = null;
//Gets the opera Installtion paths and reads to the string opera*InstallationPath
opera2InstallationPath = (string)Registry.GetValue(pegasusKey + opera2ServerPath + "System", "PathToServerDynamic", null);
opera3InstallationPath = (string)Registry.GetValue(pegasusKey + opera3ServerPath + "System", "PathToServerDynamic", null);
string Filesource = null;
string[] FileList = (string[])e.Data.GetData(DataFormats.FileDrop, false);
foreach (string File in FileList)
Filesource = File;
label.Text = Filesource;
if (System.IO.Directory.Exists(opera3InstallationPath))
{
System.IO.File.Copy(Filesource, opera3InstallationPath);
MessageBox.Show("File Copied from" + Filesource + "\n to" + opera3InstallationPath);
}
else
{
MessageBox.Show("Directory Doesn't Exist");
}
用戶拖動文件到窗口,然後我得到一個應用程序,然後將其用作目的地爲源文件..的安裝路徑當應用程序運行時,它引發錯誤目錄不找到。但是,如果目錄不存在,是否應該進入else語句?一個簡單的應用程序,正在成爲頭痛!
它實際上打的if語句? – Arran
是的,它通過if語句..我知道目錄存在 https://www.dropbox.com/s/hhro4yox0wjc63o/vs.PNG –
這是一個應用程序目錄,我看不出它如何止跌」從檢查的時候就存在嗎?寫作。它可能是停止應用程序寫入它的文件夾權限,因此拋出異常。雖然,我會雖然它會是一個不同的錯誤,如果它是關於文件夾 –