Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. progressbar problem

progressbar problem

Scheduled Pinned Locked Moved C#
help
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    wistiti5
    wrote on last edited by
    #1

    Hello, I have a problem with the progressbar in the following code: FtpClient ftp = new FtpClient("ftpadres", "user", "password",ttl,21); try { ftp.Login(); } catch (Exception ex) { MessageBox.Show(ex.Message); } ftp.ChangeDir("vrbo"); string fullPath = txtLoggedInSource.Text; string[] dir = fullPath.Split(new Char[] { '\\' }); int length = dir.Length; string directory = dir[length - 1]; ftp.MakeDir(bedrijfid + "_" + directory + "_" + timestamp); ftp.ChangeDir(bedrijfid + "_" + directory + "_" + timestamp); DirectoryInfo dir2 = new DirectoryInfo(txtLoggedInSource.Text); FileInfo[] files = dir2.GetFiles(); int filecount = files.Length; pbStatus.TabIndex = 0; pbStatus.Maximum = filecount; pbStatus.Minimum = 1; pbStatus.Step = 1; /* THIS WORKS PERFECT !!! for (int i = pbStatus.Minimum; i <= pbStatus.Maximum; i++) { pbStatus.PerformStep(); } * */ // HERE THE PROGRESSBAR DOESNT MOVE foreach (FileInfo f in files) { ftp.Upload(txtLoggedInSource.Text + "\\" + f.Name); pbStatus.PerformStep(); } label1.Text = "All files are upload successfully"; ftp.Close(); Can someone please help me why it doesn't work with upload Thx wistiti 5

    G R 2 Replies Last reply
    0
    • W wistiti5

      Hello, I have a problem with the progressbar in the following code: FtpClient ftp = new FtpClient("ftpadres", "user", "password",ttl,21); try { ftp.Login(); } catch (Exception ex) { MessageBox.Show(ex.Message); } ftp.ChangeDir("vrbo"); string fullPath = txtLoggedInSource.Text; string[] dir = fullPath.Split(new Char[] { '\\' }); int length = dir.Length; string directory = dir[length - 1]; ftp.MakeDir(bedrijfid + "_" + directory + "_" + timestamp); ftp.ChangeDir(bedrijfid + "_" + directory + "_" + timestamp); DirectoryInfo dir2 = new DirectoryInfo(txtLoggedInSource.Text); FileInfo[] files = dir2.GetFiles(); int filecount = files.Length; pbStatus.TabIndex = 0; pbStatus.Maximum = filecount; pbStatus.Minimum = 1; pbStatus.Step = 1; /* THIS WORKS PERFECT !!! for (int i = pbStatus.Minimum; i <= pbStatus.Maximum; i++) { pbStatus.PerformStep(); } * */ // HERE THE PROGRESSBAR DOESNT MOVE foreach (FileInfo f in files) { ftp.Upload(txtLoggedInSource.Text + "\\" + f.Name); pbStatus.PerformStep(); } label1.Text = "All files are upload successfully"; ftp.Close(); Can someone please help me why it doesn't work with upload Thx wistiti 5

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      Standard question #1: What do you mean by "not working"? --- b { font-weight: normal; }

      1 Reply Last reply
      0
      • W wistiti5

        Hello, I have a problem with the progressbar in the following code: FtpClient ftp = new FtpClient("ftpadres", "user", "password",ttl,21); try { ftp.Login(); } catch (Exception ex) { MessageBox.Show(ex.Message); } ftp.ChangeDir("vrbo"); string fullPath = txtLoggedInSource.Text; string[] dir = fullPath.Split(new Char[] { '\\' }); int length = dir.Length; string directory = dir[length - 1]; ftp.MakeDir(bedrijfid + "_" + directory + "_" + timestamp); ftp.ChangeDir(bedrijfid + "_" + directory + "_" + timestamp); DirectoryInfo dir2 = new DirectoryInfo(txtLoggedInSource.Text); FileInfo[] files = dir2.GetFiles(); int filecount = files.Length; pbStatus.TabIndex = 0; pbStatus.Maximum = filecount; pbStatus.Minimum = 1; pbStatus.Step = 1; /* THIS WORKS PERFECT !!! for (int i = pbStatus.Minimum; i <= pbStatus.Maximum; i++) { pbStatus.PerformStep(); } * */ // HERE THE PROGRESSBAR DOESNT MOVE foreach (FileInfo f in files) { ftp.Upload(txtLoggedInSource.Text + "\\" + f.Name); pbStatus.PerformStep(); } label1.Text = "All files are upload successfully"; ftp.Close(); Can someone please help me why it doesn't work with upload Thx wistiti 5

        R Offline
        R Offline
        Ravi Bhavnani
        wrote on last edited by
        #3

        You're not giving the form a chance to update itself. See if this works:

        foreach (FileInfo f in files) {
        ftp.Upload (txtLoggedInSource.Text + "\\" + f.Name);
        pbStatus.PerformStep();
        Application.DoEvents(); // not this.DoEvents();
        }

        /ravi My new year's resolution: 2048 x 1536 Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)com -- modified at 0:15 Sunday 23rd April, 2006

        K 1 Reply Last reply
        0
        • R Ravi Bhavnani

          You're not giving the form a chance to update itself. See if this works:

          foreach (FileInfo f in files) {
          ftp.Upload (txtLoggedInSource.Text + "\\" + f.Name);
          pbStatus.PerformStep();
          Application.DoEvents(); // not this.DoEvents();
          }

          /ravi My new year's resolution: 2048 x 1536 Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)com -- modified at 0:15 Sunday 23rd April, 2006

          K Offline
          K Offline
          kasik
          wrote on last edited by
          #4

          Ravi Bhavnani wrote:

          this.DoEvents();

          You mean

          Application.DoEvents();
          

          no? :) Cheers, Will H

          R 1 Reply Last reply
          0
          • K kasik

            Ravi Bhavnani wrote:

            this.DoEvents();

            You mean

            Application.DoEvents();
            

            no? :) Cheers, Will H

            R Offline
            R Offline
            Ravi Bhavnani
            wrote on last edited by
            #5

            Yes. :-O /ravi My new year's resolution: 2048 x 1536 Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)com

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups