Link to home
Start Free TrialLog in
Avatar of VBdotnet2005
VBdotnet2005Flag for United States of America

asked on

Progress bar

how can I display percentage of progress bar?


        Me.ProgressBar1.Minimum = 0
        Me.ProgressBar1.Maximum = GetCountmyfiles()
        Me.ProgressBar1.Value = 1
        Me.ProgressBar1.Step = 1



        For Each Filex In myDir.GetFiles


            Me.ProgressBar1.PerformStep()
            myfile.move(mypath)      
          me.mylable1.txt = ????      

                  
            
      next
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Since you are using a For Each to iterate the files you don't know what current "number" file you are working with.

Either...

(1) Change to an indexed For Loop.
(2) Use a seperate "counter" variable that you manually increment after each iteration
(3) Use the Value property of the ProgressBar:

    ProgressBar1.PerformStep()
    Label11.Text = CInt(ProgressBar1.Value / ProgressBar1.Maximum * 100)
Avatar of VBdotnet2005

ASKER

dim CountProbar as integer = 0


   For Each myfile In myDir.GetFiles

            CountProbar += 1


            Me.ProgressBar1.PerformStep()
            Me.TextBox2.Text = "In progress...  " & CInt(ProgressBar1.Value _            /ProgressBar1.Maximum * 100)

next
Idle_Mind:,

Obove code does not work for me...
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial