tom
tom

Reputation: 5001

Loading icon / progress bar

what control can i use to place in my programme so that i can have a loading bar. For example

ProgressBar pb = new ProgressBar();
pb.start();
connectToDatabase();
pb.stop();

Is this possible in c#?

Thanks

Upvotes: 1

Views: 9366

Answers (3)

Jonathan Wood
Jonathan Wood

Reputation: 67213

A ProgressBar requires your code to periodically update the progress as you work through the task. Also, the progress only has meaning when you can roughly calculate what percent you have completed.

If you just want something moving to show that the program is busy, you can set the progress bar Style property to ProgressBarStyle.Marquee. This style is used to indicate something is happening without reporting the percent the task is complete.

Upvotes: 3

KeithS
KeithS

Reputation: 71573

Sure. There's a ProgressBar control in the Windows Forms library. Set its Style to Marquee and you should get a scrolling on/off pattern that indicates progress is being made.

Upvotes: 4

NotJarvis
NotJarvis

Reputation: 1247

Is there not a simple control called progressbar? Or are you asking something more complex that I'm missing?

Heres a knowledgebase article about created a smooth progressbar Link to Article.

And heres a tutorial

Upvotes: 1

Related Questions