hello. I have a try-catch statement in reference to downloading a file. When the file is downloaded, I then enable one of my menu items then turn off a timer set to retry the download in one minute.
My problem is that for some reason my "trafficManagementToolStripMenuItem.Enabled = true;" line is activating the catch statement even though, the menu item is being enabled. The file correctly downloads and when I comment out that line, it works perfectly. But every time I run it, i get the "error" message box and the timer is not disabled. Even though the menu item correctly enables after the download is complete.
any ideas?
try
{
////downloads Data
string address = "http://website.file.txt";
string filename = "vsd.txt";
WebClient client = new WebClient();
client.DownloadFile(address, filename);
trafficManagementToolStripMenuItem.Enabled = true;
timer1.Enabled = false;
}
catch
{
timer1.Enabled = true;
MessageBox.Show("error", "test");
}