I am stuck in a problem where I should show a progress in % in a label. I have manage this code and think this should work but the label doesn´t update the % value it only shows "Progress... 0 %".
Is there anything I perheps should add to update the value in the label in realtime.
I have instead of:
Application:: DoEvents()

Also tried this without success.

//Show progress in %
double ShowProgress = 0;

 for( int i = 0; i < 2231; ++i )
ShowProgress = (i / 2231) * 100;
label1->Text = "Progress... " + Convert::ToString(ShowProgress) + " %" ;

Application::DoEvents(); //Update Form

You are making the mistake of assuming that integer division yields a floating point result - it doesn't: it yields an integer result and integers can't represent fractions.

In your code i/2231 is an integer division, and yields an integer result by rounding towards zero (hence always yields zero if i is in the range [0,2231) ).

You need to force the division i/2231 to be a floating point division to get the result you expect. For example;

ShowProgress = ((double)i / 2231) * 100;


ShowProgress = (i / 2231.0) * 100;

Yes, that was the problem :)

Thank you very much for your help.