Progressbar not updating :'(
please help.
Private Sub ftpupload()
Dim ext As String = Path.GetExtension(NsTextBox1.Text)
Dim fname As String = Path.GetFileNameWithoutExtension(NsTextBox1.Text)
Dim request As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create("ftp://xxx@xxx.org/" & fname & ext), System.Net.FtpWebRequest)
request.Credentials = New System.Net.NetworkCredential("xxx@xxx.org", "xxxxxxx")
request.Method = System.Net.WebRequestMethods.Ftp.UploadFile
Dim file() As Byte = System.IO.File.ReadAllBytes(NsTextBox1.Text)
Dim strr As System.IO.Stream = request.GetRequestStream()
Do While i <= 100
strr.Write(file, 0, file.Length)
progress = strr.Length * i / 100
BackgroundWorker1.ReportProgress(progress)
Loop
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
BackgroundWorker1.WorkerReportsProgress = True
loadauthors()
End Sub
Private Sub xButton1_Click(sender As Object, e As EventArgs) Handles NsButton1.Click
BackgroundWorker1.RunWorkerAsync()
End Sub
Private Sub BackgroundWorker1_ProgressChanged(sender As Object, e As ComponentModel.ProgressChangedEventArgs) Handles BackgroundWorker1.ProgressChanged
xProgressBar1.Value = e.ProgressPercentage
End Sub
Private Sub BackgroundWorker1_DoWork(sender As Object, e As ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
ftpupload()
End Sub