If you are using a login form in your .Net Windows Forms application you might want to show a progress bar to the user during authentication takes a little time. Doing that makes your application responsive and makes the users think your application is doing some work and not stuck.
You choose the Style property of the progress bar as "Marquee" since you do not know how long authentication will take (possibly not more than 1 or 2 seconds but sometimes servers may respond a little longer than that).
By creating the progress bar control with the Marquee style, you can animate it in a way that shows activity but does not indicate what proportion of the task is complete. The highlighted part of the progress bar moves repeatedly along the length of the bar. You can start and stop the animation, and control its speed.
In this example when the user enters the user name / password and hits the "Go" button, the lengthy operation is emulated by Thread.Sleep(3000) call. All the labels, textboxes and the submit button are disabled when the highlight of the progress bar moves for 3 seconds. After it finishes moving the controls are enabled again and progress bar is hidden by Hide() method of itself. This gives the cue to the users that they cannot change their input during the authentication process.
Arda Basoglu is a software engineer, musician. Worked for BNB Yazılım, PINC Solutions, hakia, Nurol, NTV. He writes automated trading software lately. He plays guitar and bass in his spare times in a couple of bands.