I have a few nested for loops, and I was wondering if I could get the data while it's processing it, So I can show it on the screen as a loading bar.
Here's an example:
double currentData;
double endData = 50 * 50 * 50;
for(int i = 0; i < 50; i++)
{
for(int e = 0; e < 50; e++)
{
for(int a = 0; a < 50; a++)
{
currentData = a * e * i;
}
}
}
label1.Text = "Loading: " + Convert.ToString(100/endData * currentData) + "%.";
If I'm not wrong, for loops make the program "freeze" until its done, so that's probably why this code won't work. Any suggestions?
Thanks