aspdotnet-suresh offers articles and tutorials,csharp dot net, articles and tutorials,VB.NET Articles,Gridview articles,code examples of 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

how to use progressbar control in windows application using

Dec 23, 2010

Here I will explain how to use progressbar control in windows application using


I have done one windows application in that I have one form like creating user and assigning permission to user during at the time of user creation and displaying that result in one data gridview for this process it’s taking time at that time user don’t know what is happening after button click for that reason I have used progressbar to give hint like processing. Previously I have implemented progress bar during postbacks in check that article here how to show progressbar during postbacks in .

We can specify different styles to progressbar we have three types of styles are available.
1.    1) Blocks
2.    2) Continuous
3.    3) Marquee 


This property Indicates progress by increasing the number of segmented blocks in a ProgressBar.


This property Indicates progress by increasing the size of a smooth, continuous bar in a ProgressBar.


This Property indicates progress by continuously scrolling a block across a ProgressBar in a marquee fashion.

To implement progressbar in windows applications follow these steps.

1)    First open visual studio

2)    Select New --> Projects --> Select Windows Form Application --> Give Name for that project

3)    Now one form will open.

Open Toolbox in that select progressbar control and drag and drop it on your form same drag one button.

Here my requirement is if I click on button I need to register user and assign roles and showing result in this mean time I need to show the progressbar for that I have written following code in button click 

This example shows progressbar during registration of all users

private void btnCreate_Click(object sender, EventArgs e)
// Set Minimum to 1 to represent the first file being copied.
Progressbar1.Minimum = 1;
// Set Maximum to the total number of Users created.
Progressbar1.Maximum = dt.Rows.Count;
// Set the initial value of the ProgressBar.
Progressbar1.Value = 1;
// Set the Step property to a value of 1 to represent each user is being created.
Progressbar1.Step = 1;

// Loop through all files to copy.
for (int i = 1; i <= dt.Rows.Count; i++)
bool result=InsertUserdetails(Username);
// Copy the file and increment the ProgressBar if successful.
if(result== true)
// Perform the increment on the ProgressBar.

Here I will explain clearly what each step says

Progressbar1.Minimum = 1;

Progressbar1.Maximum = dt.Rows.Count;

Here Minimum and Maximum properties define the range of values that means how much time that progressbar we need display.

Minimum property is basically set to a value 0
Maximum property is typically set to value of indicating the completion of task.

After that Progressbar1.Value = 1;

This value property determines when to display the nextblock(Blocks) or increase the size of bar (Continuous).

Progressbar1.Step = 1;

Set the Step property to a value of 1 to represent each user is being created.


This method will increment the value of the ProgressBar as each user registered. After completion of user registration progress bar shows fully loaded.

I hope it helps you 

If you enjoyed this post, please support the blog below. It's FREE!

Get the latest,, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email


fahim ansari said...

Thanks for the post. It helps me a lot.

Ashish Srivastava said...

Thank you it helped a lot

Anonymous said...

No comments ... it's good.

Nimz said...

Very Helpful

keerthi said...

its useful

Anonymous said...

thanks a lot

Anonymous said...

what is dt

Donald said...

helpful info... Thanks

Anonymous said...


Anonymous said...

Nice Wonderfull

Anonymous said...

Thanks a lot

Unknown said...

hi suresh .. ur article was so good. but i have one doubt.. how to update a progressbar while application statup based on the database data loading...
help me

Thanks in Advance

vikas choudahry said...

is that any dynamic in winform based.I need progress bar till data is inserted.after that thread be dead or any other way is requested instead of thread.

Unknown said...

helpful Page.... and also i am looking for the Progressbar with percentage sent, Please can u help regarding that....

Unknown said...

I need to run progress bar according to timer, ie, if I put timer for one min, progress bar should run for one min.
How can I do that.
Please help me for that.

Unknown said...

very nice..........

preety said...

nice one , it helped me

Unknown said...

i want progress bar when i click on button for some my own operation like transferring data or retrive data....when system loading that time i want progress bar...not like this as u given

Anonymous said...

Very useful thanks a lot

Give your Valuable Comments

Note: Only a member of this blog may post a comment.

© 2015 All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.