WebClient.DownloadProgressChanged不适用于大型文件VB.net

编程入门 行业动态 更新时间:2024-10-27 18:31:36
本文介绍了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

本文发布于:2023-11-08 09:38:55,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1569023.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不适用于   文件   DownloadProgressChanged   WebClient   VB

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!