Farhan Shariff

Farhan Shariff

  • NA
  • 933
  • 242.2k

Avoid multiple Process Bar when Re - executing

Aug 11 2014 5:37 AM
I have a application in which I use a process bar which starts after I click Start button (Start button is disabled after I click ) and once the process is complete the start button is enabled.
when I click start again there are 2 process bars I just want one process bar every time I re- execute
 
 
 
 
 
 
button1.Enabled = false;
pBar = new ProgressBar(); // now assigning to field
Controls.Add(pBar);
pBar.Name = "ProgresBar1";
pBar.Dock = DockStyle.Bottom;
pBar.Style = ProgressBarStyle.Marquee;
pBar.MarqueeAnimationSpeed = 10;
pBar.Width = 100;
pBar.Height = 30;
pBar.Minimum = 0;
pBar.Maximum = 100;
pBar.Value = 100;
//-------------------------------------------------
System.Threading.Thread.Sleep(10000);
//--------Statements----------------------------------------
//------------------------------------------------
pBar.Style = ProgressBarStyle.Continuous;
pBar.MarqueeAnimationSpeed = 5;
button1.Enabled = true;
 

Answers (3)