I don't know how long an action could take and I want to display a progress bar to the user in a dialog box. I've tried using System.Windows.Forms.ProgressBar but it doesn't seem to support it.

An example of what I'd want is the progress bar that windows shows you when it's looking for new drivers on the internet. It's just got three or four 'bars' going back and forth marquee style on the progress bar.

No mess creating never ending progress bar? All you have to do is setting the animation of marquee to 0 once finished and set the Visible property of the progressbar to false. Its no magic.
–
HoumanMar 7 '11 at 12:57

I feel physical pain every time I see a program doing that. From a usability POV, this is among the worst things a lazy programmer can do. It is uninformative, wrong, distracting, annoying and diminishing user trust in the "progress bar"-metaphor as a whole. Even no progress bar at all is better.
–
TomalakMar 11 '09 at 19:34

Agreed. Probably the best solution for a long-running process for which no progress information can ever be obtained (the question was a bit unclear), would be no progress bar at all ... but hey, he asked how to get an indeterminate one :)
–
JoeyMar 11 '09 at 19:44

Seems like I misread the desired effect. That was the only infinite progress bar that I could remember off the top of my head.
–
Davy8Mar 11 '09 at 19:45

No progress bar is definitely worse if it's going to be long (say more than 10-30 seconds depending on the patience of the person and how slow they expect their computer to be. I usually consider killing a process after 30 seconds of no progress indication
–
Davy8Mar 11 '09 at 19:47

@Davy8: I've always liked the idea of a logo (i.e. an analogue clock abstraction) that rotates a bit when something happens ("file copied" event or such). If many things happen it rotates fast, if few things happen, it rotates slowly. If the process is dead, it does not rotate at all.
–
TomalakMar 11 '09 at 19:52