Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Progress bar

Posted on 2007-10-03
4
Medium Priority
?
443 Views
Last Modified: 2012-05-05
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
0
Comment
Question by:VBdotnet2005
  • 2
  • 2
4 Comments
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 20010514
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)
0
 

Author Comment

by:VBdotnet2005
ID: 20015445
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
0
 

Author Comment

by:VBdotnet2005
ID: 20018704
Idle_Mind:,

Obove code does not work for me...
0
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 1000 total points
ID: 20019070
What exactly doesn't work?

You may need a call to Application.DoEvents() to allow the controls to update themselves:

     For Each myfile In myDir.GetFiles
            ' CountProbar += 1 <------------ Don't need this if you are using the Value() prop of the ProgressBar!

            ...

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

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Integration Management Part 2
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question