DownloadProgressChanged

DownloadProgressChanged

本文介绍了WebClient.DownloadProgressChanged不适用于大型文件VB.net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将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





推荐答案


这篇关于WebClient.DownloadProgressChanged不适用于大型文件VB.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-13 13:32