dim withevents mywebclient as new system.net.webclient
Private Sub Button1_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim fod As New System.Windows.Forms.OpenFileDialog
If fod.ShowDialog = Windows.Forms.DialogResult.OK Then
'MsgBox(System.IO.Path.GetFileName(fod.FileName).ToString)
Dim isa As Boolean = My.Computer.Network.IsAvailable
If isa = True Then
Dim remoteUri As String = fod.FileName
mywebclient = New System.Net.WebClient
Dim fileName As String
fileName = "c:\" + System.IO.Path.GetFileName(fod.FileName)
mywebclient.DownloadFileAsync(New Uri(remoteUri), fileName)
Dim FmDB As Integer
FmDB = FileLen(fileName) / 1024
Me.ProgressBar1.Maximum = 100
Me.ProgressBar1.Minimum = 0
Me.ProgressBar1.Step = 1
Else
MsgBox("电脑网络未连接.不能使用该功能")
End If
End If
End Sub
Private Sub myWebclient_DownloadProgressChanged(ByVal sender As Object, ByVal e As System.Net.DownloadProgressChangedEventArgs) Handles mywebclient.DownloadProgressChanged