BackGroundWorker不显示百分比(Visual Basic)

时间:2019-12-05 12:31:35

标签: vb.net winforms background

在我的应用程序中完成上传后,我想查看百分比。为了避免意外的阻塞,上传是通过后台工作程序完成的。不幸的是,尽管我声明了以下百分比,但该百分比并未更新:

BackgroundWorker1.WorkerReportsProgress = True

这是我的代码:

 Private Sub BackgroundWorker1_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
        My.Computer.Network.UploadFile(File, FtpAdress)
    End Sub

 Private Sub BackgroundWorker1_ProgressChanged(sender As Object, e As ProgressChangedEventArgs) Handles BackgroundWorker1.ProgressChanged
    ProgressBar1.Value = e.ProgressPercentage
    Label.Text = "Upload progress percentage: " + e.ProgressPercentage.toString + "%"
End Sub

上传正确完成,但百分比未更新。 对不起,我的英语不好,谢谢您能回答我的问题!

0 个答案:

没有答案