PDA

View Full Version : سوال: دانلود فایل



sajjadgh
سه شنبه 09 تیر 1394, 04:04 صبح
سلام خسته نباشید این تکه کد برای دانلود یک فایل به کار میره اگه میشه برام توضیح بدین چجوری کار میکنه ممنون

Private WithEvents httpclient As WebClient
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
savepathlab.Text = ""
End Sub


Private Sub download_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
httpclient = New WebClient
AddHandler httpclient.DownloadFileCompleted, AddressOf downloade
httpclient.DownloadFileAsync(New Uri("http://cld4.cdn.p30download.com/p30dl-software/Internet.Download.Manager.v6.23.Build.12_p30downlo ad.com.rar"), ("C:\netfx2.exe"))
End Sub
Private Sub dpc(ByVal sender As Object, ByVal e As System.Net.DownloadProgressChangedEventArgs) Handles httpclient.DownloadProgressChanged
SavePathlab.Text = e.BytesReceived / 1024S
End Sub
Private Sub Downloade()
If System.IO.File.Exists("C:\netfx2.exe") = False Then
MsgBox("Doesn't exist", 64, "Open")
End If
End Sub
ممنون