I have a progress bar whereby it should progress for every graph that is loaded.But upon executing the program, the progress bar will immediately hit 100 % even the graph had not been fully loaded. But my code is written such that the PerformStep is placed after the loading of graph. Please advice. Thanks
for (int i = 1; i <= load_graph; i++)
{
parent_form.flowLayoutPanel2.Controls.Add(
new TrendChart(aparent_form.progressBar1.TabIndex = 0;
parent_form.progressBar1.Maximum = 10000;
parent_form.progressBar1.Minimum = 1;
parent_form.progressBar1.Step = 2500;
parent_form.progressBar1.PerformStep();
}

Progress Bar
SPersels
This is because you never let the UI thread do any painting.
You can either load the graphs in a background worker (or similar multi-threaded solution) so the UI remains responsive during the load or call Application.DoEvents after each call to ProgressBar.PerformStep to let it handle its paint messages (any other pending messages will also be processed).
cmaclo
ProgressBar progressbar = parent_form.progressBar1;
progressbar.Minimun = 1;
progressbar.Maximum = _load_graph;
for (int i = 1; i <= load_graph; i++)
{
parent_form.flowLayoutPanel2.Controls.Add(new TrendChart(aIdea, root_source));
progressbar.Value = i;
}
Jartai
progressBar.Value = progressBar.MinimumValue;
Summerstreet
Man could you tell us exactly what you wanna do
Hoppe
I had tried Thread.sleep, but it will actually slow down the loading of data. Is there any other way of doing it
Please advice.
Nagendra Jammi
Hi
Could you check your MarqueeAnimationSpeed in progressbar properties.
Hope this helps
Raja Pratap Reddy
May I know how to reset the progressbar to 0 which is the minimum value
Thanks
software2
the loop executes real fast..For visual effect you should try the Thread.Sleep(500) but this is not recommanded coz if u are working with just one thread.. that threa will sleep and you will lose the UI control
Anyway.. i wanna make a progress bar that increments every time a control is loaded like textbox, button, label.. like those programs that when they appear they shou you a little form and a label that is fast changing : "Loading structures, panel, menus.." somthing like that coz i done that and maybe i can help you..
Jameslee20
aLaMaT
and if yourprogress bar performs real fast it means that you dont really need a progressbar because there is nothing to show ... coz the progress is made realtime.. progressbar is not for just visual effect.. As you saw Setup use progress bar coz they really need to.. if you copy a 100MB program then u need the progressbar and i can asure you that the progress bar will have time to be painted...
Anyway.. if i understood exactly what you wana to is to show the progress of InitializeComponent