I just want to report ProgressChanged
while executing the DoWork
method
My code is this:
Private Sub CloudDataWorker_DoWork(sender As Object, e As DoWorkEventArgs) Handles CloudDataWorker.DoWork
GlobalVartions.PushtoCloud()
CloudDataWorker.ReportProgress(100, "")
End Sub
What I have done so far is this that doesn't work.
Private Sub CloudDataWorker_ProgressChanged(sender As Object, e As ProgressChangedEventArgs) Handles CloudDataWorker.ProgressChanged
uploadStat.Text = "Uploading" & "%"
End Sub
Instead of using a Progressbar
, I want to use a percentage %
as an indicator.
How can I achieve this ? Thanks.
After too many attempts, I have done the following with this code
This is my DoWork
Method
Private Sub CloudDataWorker_DoWork(sender As Object, e As DoWorkEventArgs) Handles CloudDataWorker.DoWork
Dim i As Integer = 1
Do While (i <= 10)
If (CloudDataWorker.CancellationPending = True) Then
e.Cancel = True
Exit Do
Else
GlobalVartions.PushtoCloud()
CloudDataWorker.ReportProgress((i * 2))
End If
i = (i + 1)
Loop
End Sub
And my ProgressChanged
Method
Private Sub CloudDataWorker_ProgressChanged(sender As Object, e As ProgressChangedEventArgs) Handles CloudDataWorker.ProgressChanged
uploadStat.Text = (e.ProgressPercentage.ToString + "%")
End Sub
Now it works great . .