Home > Software engineering >  Webclient does not handle DownloadDataCompleted, DownloadProgressChanged events, to overcome.
Webclient does not handle DownloadDataCompleted, DownloadProgressChanged events, to overcome.

Time:10-14

The code is as follows:
If localrow2. Item (7)="" And Dir (Application. StartupPath & amp; "\ picdata \ toppic " & amp; The Replace (localrow2. Item (5), "/Storage/master/product/thumbs310/", ""))=" "Then
F (1)=New DownFile ()
F (1). A Url="http://www.abc.com" & amp; Localrow2. Item (5)
F (1). The File=Application. StartupPath & amp; "\ picdata \ toppic " & amp; The Replace (localrow2. Item (5), "/Storage/master/product/thumbs310/", "")
F (1). The Down ()
End the If
If localrow2. Item (8) & lt;> "" And Dir (Application. StartupPath & amp; "\ picdata \ xgpic " & amp; The Replace (localrow2. Item (8), "/Storage/master/effect/"," "))="" Then
F (2)=New DownFile ()
F (2). The Url="http://www.abc.com" & amp; Localrow2. Item (8)
F (2). The File=Application. StartupPath & amp; "\ picdata \ xgpic " & amp; The Replace (localrow2. Item (8), "/Storage/master/effect/"," ")
F (2). The Down ()
End the If
If localrow2. Item (7) & lt; & gt; "" And Dir (Application. StartupPath & amp; "\ picdata \ scpic " & amp; The Replace (localrow2. Item (7), "/Storage/master/custom/"," "))="" Then
F (3)=New DownFile ()
F (3). A Url="http://www.abc.com" & amp; Localrow2. Item (7)
F (3). The File=Application. StartupPath & amp; "\ picdata \ scpic " & amp; The Replace (localrow2. Item (7), "/Storage/master/custom/"," ")
F (3). The Down ()
End the If

Private Sub myWebclient_DownloadFileCompleted (ByVal sender As Object, ByVal e As System.Net.DownloadDataCompletedEventArgs) Handles myWebclient. DownloadDataCompleted

MsgBox (" OK ")
End Sub

Downfile () part of the code is as follows:
Public Class DownFile
Private WithEvents myWebclient As System.Net.WebClient
The Public Url As a String
The Public File As a String
Sub Down ()
MyWebclient=New Net. WebClient ()
MyWebclient. DownloadFileAsync (New Uri (Url), File)
End Sub

The End of the Class

Now the question is, why MsgBox (" OK ") is not available?
  • Related