Tuesday, 15 September 2015

c# - How to check if file downloaded successfully in Webclient DownloadFileCompleted event? -



c# - How to check if file downloaded successfully in Webclient DownloadFileCompleted event? -

private void client_downloadfilecompleted(object sender, asynccompletedeventargs e) { }

i want check these 2 cases:

if there error something.

if file downloaded something.

you can examine error , cancelled properties of asynccompletedeventargs instance:

if (e.error != null) { // there error, } else if (!e.cancelled) { // file downloaded fine , completed, }

c# .net winforms webclient

No comments:

Post a Comment