title: Displaying progress of file upload in a ProgressBar with SSH.NET
body: <p>I want to show the progress of an uploading process on my <code>ProgressBar</code>, Here is the code of my button "Upload":</p>
  
  <pre><code>private void button2_Click(object sender, EventArgs e)
  {
      int Port = int.Parse(textBox2.Text);
      string Host = textBox1.Text;
      string Username = textBox3.Text;
      string Password = textBox4.Text;
      string WorkingDirectory = textBox6.Text;
      string UploadDirectory = textBox5.Text;
  
      FileInfo FI = new FileInfo(UploadDirectory);
      string UploadFile = FI.FullName;
      Console.WriteLine(FI.Name);
      Console.WriteLine("UploadFile" + UploadFile);
  
      var Client = new SftpClient(Host, Port, Username, Password);
      Client.Connect();
      if (Client.IsConnected)
      {
          var FS = new FileStream(UploadFile, FileMode.Open);
          if (FS != null)
          {
              Client.UploadFile(FS, WorkingDirectory + FI.Name, null);
              Client.Disconnect();
              Client.Dispose();
              MessageBox.Show(
                  "Upload complete", "Information", MessageBoxButtons.OK,
                  MessageBoxIcon.Information);
          }
      }
  }
  </code></pre>