title: VB.NET Progress bar on ftp upload
body: <p>Hi I am trying to add a progress bar to a FTP image upload, though I looked at many examples over the internet and I've tried numerous things but just couldn't get anything to work with my following code. I want a progress bar to track the progress of the upload then show 100% once done.</p>
  
  <p><strong>My coding:</strong></p>
  
  <pre><code>   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  
              Dim s As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
              Static r As New Random
              Dim sb As New StringBuilder
              For i As Integer = 1 To 8
                  Dim idx As Integer = r.Next(0, 35)
                  sb.Append(s.Substring(idx, 1))
              Next
  
              Clipboard.SetText("http://my-site.com/osdf/" + sb.ToString() + ".png")
  
  
              Using ms As New System.IO.MemoryStream
                  sc.CaptureDeskTopRectangle(Me.boundsRect).Save(ms, System.Drawing.Imaging.ImageFormat.Png)
  
                  ''Close()
                  Using wc As New System.Net.WebClient
                      AddHandler wc.UploadDataCompleted, AddressOf UploadCompleted
                      wc.UploadData("ftp://USERNAME:PASSWORD@My-site.com/pic/uploads/" + sb.ToString() + ".png", ms.ToArray())
  
                  End Using
                  MsgBox("File Uploaded", MsgBoxStyle.Information)
              End Using
  
          End Sub
  </code></pre>
  
  <p>How would I be able to do this using my code?</p>
  
  <p>Thanks in advance, I will appreciate your support.</p>