For some operations such as logging on to a web site or downloading a web page, you may not know how long it will take the operation to finish.  So instead of showing a progress bar with a specified percent complete, you can set the .NET ProgressBar to cycle continuously.

ProgressBarMarquee

ASP.NET Web Hosting – 3 Months Free and Free Setup

To make a ProgressBar cycle continuously, set the MarqueeAnimationSpeed property to a positive value (by default, it is set to 0).  The value specifies the time period, in milliseconds, that it takes the progress block to scroll across the progress bar.  A higher value results in a slower speed, and a lower value results in a faster speed.  I've found that a value of 30 works pretty well.  It’s also important to set the Style property to ProgressBarStyle.Marquee.

this.ProgressBar_Download.MarqueeAnimationSpeed = 30;
this.ProgressBar_Download.Style = ProgressBarStyle.Marquee;

To stop the cycle, set the MarqueeAnimationSpeed property to 0.  To resume the cycle, set it to a positive value.

Related posts:

  1. The Proper Way to Show the Wait Cursor
  2. Show ToolTip on TabPage in TabControl
  3. Embedded Image Resources
  4. Disable the Ctrl+Tab Navigator Window in Visual Studio 2008
  5. C# WinForms Form Event Order