private void btnStart_Click(object sender, EventArgs e) { progressBar1.Maximum = 10; timer1.Interval = 1000; timer1.Start(); } private void timer1_Tick(object sender, EventArgs e) { progressBar1.Increment(1); if (progressBar1.Value == progressBar1.Maximum) { timer1.Stop(); } }
private void btnStart_Click(object sender, EventArgs e) { progressBar1.Maximum = int.Parse(txtMax.Text); progressBar1.Value = 0; progressBar1.Step = int.Parse(txtIncrement.Text); timer1.Interval = 1000; timer1.Start(); } private void timer1_Tick(object sender, EventArgs e) { progressBar1.PerformStep(); if (progressBar1.Value == progressBar1.Maximum) { timer1.Stop(); } }Both example use the .NET Framework, specifically the System.Windows.Forms namespace.