Progress bar
hi. i try to create a simple web browser & i need see status load page in my progress bar. i read a msdn & i cant understand what i must to do. maybe someone give me a litle sample or somthing else ;).
thanks a lot
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
will he14 pointsPosted Feb 15, 2006, 7:52 AM EST
1. get a progressBar and set the properties. What I set is : Maximum 100, Minimun 1, Step 1, TabIndex o, value 1.
2. Reset your Maximun value base on your program. In my below example, I am doing a loop by using foreach, so I would like the progressBar show the whole loop process, so I set "progressBar1.Maximun = fileArray.Length" before my foreach loop.
3. At the end of the foreach loop, I add "progressBar1.PerformStep();" to let bar run.
4. Final step is clear the bar after the program finish running. So at the end of the mothod "goButton_Click(...)" , I use progressBar.value = 1.
Hope it can help you out.
private void goButton_Click(object sender, System.EventArgs e) { goButton.Enabled = false;..........
..........
progressBar1.Maximum = fileArray.Length; //set the Maximun for progress Bar
//process all the selected files in the folder
foreach(string myFile in fileArray)
{
..............
.............progressBar1.PerformStep(); //perform progressBar
}
........
.......
progressBar1.Value = 1; //reset progressBar}