Is there a way in which can use a for-loop to read numerical values 
from a edit box? I know a Inputbox will work better, but is there a 
way to make this code work?

   sum := 0;
   iMax := 0;
   iMin := 1000000000;
   for j := 1 to 5 do
      begin
         sNumber := edtNum.text;
         iNumber := StrToInt(sNumber);
         if iNumber > iMax then iMax := iNumber;
         if iNumber < iMin then iMin := iNumber;
         sum := sum + iNumber;
         edtNum.text := '0';
         edtNum.SetFocus;
         aPPLICATION.ProcessMessages;
      end;
   btnGo.Enabled := false;
   rAvg := sum / j;
   lblMax.Caption := 'Maximum value: ' + IntToStr(iMax);
   lblMin.caption := 'Minimum value: ' + IntToStr(iMin);
   lblAvg.Caption := 'Average value: ' + FloatToStrF(rAvg, ffFixed, 
2,2);

The loop is only enters one value - due to the .ProcessMessages, else 
no values gets read.

Reply via email to