2010年12月23日 星期四

增加 WebClient.DownloadProgressChanged 事件

Public Shared Sub DownLoadFileInBackground2(ByVal address As String)

Dim client As WebClient = New WebClient()

' Specify that the DownloadFileCallback method gets called
' when the download completes.
AddHandler client.DownloadFileCompleted, AddressOf DownloadFileCallback2
' Specify a progress notification handler.
AddHandler client.DownloadProgressChanged, AddressOf DownloadProgressCallback
Dim uri as Uri = New Uri(address)
client.DownloadFileAsync(uri, "serverdata.txt")
End Sub

沒有留言:

張貼留言