Re: Unable to do a repeat calculation without closing down and starting up again.Posted by Lionel on January 23, 2004 at 04:33:51: In Reply to: Re: Unable to do a repeat calculation without closing down and starting up again. posted by webmaster Guido on January 21, 2004 at 15:48:36:
: : I don't know if this is a memory thing or not but I have two math routines on one page with each having an event button and a clearing button, the variables are not the same in each routine and the Edit boxes are numbered different in each routine and I can clear the data entry and results out of each edit box but I am not able to do a repeat calculation without closing down and starting the application up again. I have tried zeroing out the variables before each repeat but still get no second results or I get the wrong results. I feel sure that others have run into this type proplem of problem and I would be interested in knowing how to handle it. : To debug this type of problem, it's best to cut it up in smaller pieces. : 1. Make a copy of the entire project, let's say Project2. : 2. Make another copy of the entire project, let's say Project3. : In other words, make the testversion of the program smaller and smaller, until you have isolated the error. : Let me know what the results are, if possible with some example code, and I can have a closer look at it. procedure TForm1.Button1Click(Sender: TObject); VAR Num1, Num2, ANS : Variant; begin Num1:=Edit1.Text; Num2:=Edit2.Text; //----------------- ANS:= Num1 * Num2; //------------------- Label7.Caption:=FloatToStr(ANS); //----------------- end; procedure TForm1.Button2Click(Sender: TObject); begin Edit1.Clear; Edit2.Clear; label7.visible:=False; end; procedure TForm1.Button3Click(Sender: TObject); VAR Num3, Num4, ans : Variant; begin Num3:=(Edit3.Text); Num4:=(Edit4.Text); //--------------------- ans:=Num3*Num4; //------------------- Label8.Caption:=FloatToStr(ans); end; procedure TForm1.Button4Click(Sender: TObject); begin Edit3.Clear; Edit4.Clear; //----------- Label8.Visible:=false; end; procedure TForm1.Button6Click(Sender: TObject); begin Close; end; procedure TForm1.Button5Click(Sender: TObject); begin Close; end; end.
|
|