【发布时间】:2018-03-03 17:46:50
【问题描述】:
我正在尝试从服务器下载文件,但未调用“DownloadFileCompleted”事件。 有人知道为什么吗?
来源:
Public Event DownloadFileCompleted As AsyncCompletedEventHandler
Public Sub DownloadCompleted(sender As Object, e As AsyncCompletedEventArgs)
MsgBox("Downloaded")
End Sub
Private Function DLOAD()
Try
Dim WebClientT As New System.Net.WebClient()
AddHandler WebClientT.DownloadFileCompleted, AddressOf DownloadFileCompletedD
ByteArray = WebClientT.DownloadData("https://ip/file.filetype")
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Function
【问题讨论】:
标签: vb.net network-programming webclient