So first create a C# Application and add progress bar control on your form, you can give it any name but i am naming it "pb" here. Add timer and name it as "tr".Now paste the following code in form load event
private void frmProgressbar_Load(object sender, EventArgs e)
{
pb.Minimum = 0; // set Minimum to 0
pb.Maximum = 100;// set Maximum t0 100
tr.Interval = 100;// timer ticks each 100 milliseconds
tr.Enabled = true; // start the timer
}
Now paste the following code behind Timer Tick Event
private void tr_Tick(object sender, EventArgs e)
{
if(pb.Value!=100) // check if value below 100 as it shud not be greater than maximum value
{
pb.Value += 5;// add 5 to the Progressbar current value
}
}
Thats it!! its done, isn't it simple? :P.I hope this will help you
0 comments:
Post a Comment