level 13
wahaha216
楼主
写了个更新程序用的,然后读取远程文本,再分割下载列表到listbox里
之后有个按钮是更新
这是部分代码
Dim dFile As New WebClient
Dim DFileName As String
Dim temp1() As String
For i = 0 To ListBox2.Items.Count - 1
temp1 = ListBox2.Items.Item(i).Split("/")
DFileName = temp1(temp1.Count - 1)
update_(DFileName, New Uri(Url & ListBox2.Items.Item(i)))
Do Until Download_Find
Application.DoEvents()
Loop
Next
Private Sub update_(DFileName As String, DUri As Uri)
Myrq = CType(WebRequest.Create(DUri), HttpWebRequest)
Myrq.Method = "GET"
myrp = CType(Myrq.GetResponse(), HttpWebResponse)
dFile = New WebClient
AddHandler dFile.DownloadProgressChanged, AddressOf ShowDownProgress
AddHandler dFile.DownloadFileCompleted, AddressOf DownloadFileCompleted
dFile.DownloadFileAsync(DUri, Application.StartupPath & "\" & DFileName)
End Sub
第一个从获取大小到下载完成一切正常
第二个能获取到大小,但是一直没有已下载的字节数据,到目录里去右键属性也是0字节
2016年03月13日 04点03分
1
之后有个按钮是更新
这是部分代码
Dim dFile As New WebClient
Dim DFileName As String
Dim temp1() As String
For i = 0 To ListBox2.Items.Count - 1
temp1 = ListBox2.Items.Item(i).Split("/")
DFileName = temp1(temp1.Count - 1)
update_(DFileName, New Uri(Url & ListBox2.Items.Item(i)))
Do Until Download_Find
Application.DoEvents()
Loop
Next
Private Sub update_(DFileName As String, DUri As Uri)
Myrq = CType(WebRequest.Create(DUri), HttpWebRequest)
Myrq.Method = "GET"
myrp = CType(Myrq.GetResponse(), HttpWebResponse)
dFile = New WebClient
AddHandler dFile.DownloadProgressChanged, AddressOf ShowDownProgress
AddHandler dFile.DownloadFileCompleted, AddressOf DownloadFileCompleted
dFile.DownloadFileAsync(DUri, Application.StartupPath & "\" & DFileName)
End Sub
第一个从获取大小到下载完成一切正常
第二个能获取到大小,但是一直没有已下载的字节数据,到目录里去右键属性也是0字节