Click here to Skip to main content
15,896,201 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi guys,

I'm creating a file transfer program. While transfer start, progress bar will be visible. I do transferring using backgroundworker. How to set the percentage of progress bar related to the transfering file? Should I divide the total file send? Or total file size?

On what backgroundworker process should I put it the calculation?

I just got this code from Google and wonder how to pass the percentage to the progressbar value. Can someone help me?

VB
Private Sub BackgroundWorker1_ProgressChanged(ByVal sender As Object, ByVal e As ProgressChangedEventArgs) Handles BackgroundWorker1.ProgressChanged
    Invoke(Sub()
               Me.progressbar.Value = e.ProgressPercentage
           End Sub)
End Sub
Posted

1 solution

check below Tip
BackgroundWorker and ProgressBar demo[^]
you can call ReportProgress method of backgroundWorker based on the percentage of the transfer. percentage of transferring file depend on how you do the transferring data.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900