Pirahnaplant
Well-known member
- Joined
- Mar 29, 2009
- Messages
- 75
- Programming Experience
- 3-5
I'm currently using this code to download an updated version of a file from the web:
The file is already stored in filename.txt and should be overwritten when this code is run.
It usually works, but if I'm not connected to the internet, then it deletes the file then causes an error. So, if I put it in a Try...Catch block, it will still delete the file.
Basically, I need a good way to download a file and overwrite a local file, but do nothing if the file can't be downloaded.
Edit: Oops, I posted this in the wrong forum, could someone move please?
VB.NET:
Dim wc As New WebClient
wc.DownloadFile("weburl", "filename.txt")
It usually works, but if I'm not connected to the internet, then it deletes the file then causes an error. So, if I put it in a Try...Catch block, it will still delete the file.
Basically, I need a good way to download a file and overwrite a local file, but do nothing if the file can't be downloaded.
Edit: Oops, I posted this in the wrong forum, could someone move please?
Last edited: