本文介绍了WebClient.DownloadProgressChanged不适用于大型文件VB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我将Microsoft示例用于"WebClient"但Progressbar无法填写"DownloadProgressChanged"当我下载一个大文件(25MB)时的事件。 可能是因为我检查了IF和循环工作而无法刷新界面! 我测试了小文件工作很好。 谁有任何想法
I use Microsoft sample for "WebClient" but Progressbar cant fills in "DownloadProgressChanged" event when I download a large file (25MB). maybe that cant refresh interface because I checked with an IF and loop working! I tested with small file working good. Do who have any idea
我为你做空:
Imports System.Net Public Class Form1 Dim client As WebClient = New WebClient() Public Sub DownLoadFileInBackground2(ByVal address As String) AddHandler client.DownloadProgressChanged, AddressOf DownloadProgressCallback Dim uri As Uri = New Uri(address) client.DownloadFileAsync(uri, "serverdata.txt") End Sub Private Sub DownloadProgressCallback(ByVal sender As Object, ByVal e As DownloadProgressChangedEventArgs) 'ProgressBar maxvalue set to 999999999 ProgressBar1.value = e.ProgressPercentage End Sub End Class
推荐答案
我认为您应该设置 ProgressBar <的 MaxValue / em>为100,因为进度以百分比形式报告。
I think that you should set the MaxValue of ProgressBar to 100, since the progress is reported in percent.
更多推荐
WebClient.DownloadProgressChanged不适用于大型文件VB.net
发布评论