How to show progressbar while some process is in progress in windows forms application


Sometimes we are processing long time at that time user need to wait for process to complete

If we don’t show any progress user might feel something uncomfortable. To give relax from that feel we have to show some progress about that process.

How to show that progress:

First design the form as follows:

Controls to place in form:

1.Progressbar

2.timer

3.button

4.label

After adding these controls to form set the following properties:

For Progressbar:

Set value property = 10

Set maximum property  = 1000

Minimum = 10

Step = 1

Then write following code under button click event

timer1.Enabled = true;

 

then write following  code under timer tick event

if (progressBar1.Value < progressBar1.Maximum)

{

progressBar1.PerformStep();

}

else

{

this.Hide();

timer1.Enabled = false;

MessageBox.Show(“your data send…”);

}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s