0
我有一個文件不會下載的問題,即使它顯示爲已完成。即使它說它沒有下載文件
該文件沒有顯示在它應該被下載到的位置。
這是我的代碼:
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if(e.ColumnIndex == 2)
{
int rowIndex = e.RowIndex;
DataGridViewRow row = dataGridView1.Rows[rowIndex];
string value1 = row.Cells[2].Value.ToString();
wc.DownloadFileCompleted += new AsyncCompletedEventHandler(AtlasCompleted);
Uri fileUrl = new Uri(value1);
Beta = fileUrl;
//Console.WriteLine(FormPopup.Variables.Location1.Length);
if (FormPopup.Variables.Location1 != null && FormPopup.Variables.Location1.Length >= 5)
{
Console.WriteLine(FormPopup.Variables.Location1);
Console.WriteLine(fileUrl);
wc.DownloadFileAsync(fileUrl, FormPopup.Variables.Location1);
//MessageBox.Show(fileUrl.ToString() + " " + FormPopup.Variables.Location1);
}
else
{
MessageBox.Show("Error: No file location specified.");
FormPopup form = new FormPopup();
form.Show(this);
}
}
}
private void AtlasCompleted(object sender, AsyncCompletedEventArgs e)
{
MessageBox.Show(Beta.ToString() + " " + FormPopup.Variables.Location1);
}
該文件應該下載,但它不是下載或出現在指定的位置。
如果任何人都可以提供幫助,那就太棒了,它讓我很困惑。
感謝您的答覆:d
你在哪裏指定保存文件的路徑? AtlasCompleted被稱爲? –
我以另一種形式指定路徑,將其保存在FormPopup.Variables.Location1下,它顯示正確的路徑,並且正在調用AtlasCompleted,但該文件沒有找到的位置。 – ZiiM
我注意到一件事,該程序似乎即刻完成它。似乎沒有時間。 – ZiiM