Re: RadioButton - Making a choice and continuing

Posted by webmaster Guido on February 27, 2006

In Reply to RadioButton - Making a choice and continuing posted by Lionel on February 27, 2006

: I am using the following code to select one of two possiable edit boxes choices and continuing with the application. If the user does not check the RadioButton associated with the selection the application crashes. ?
: This is the way I have it set up for now:
: //************************************
: if RadioButton1.checked then
: Radius:=Edit2.Text;
: Tangent:=Radius*Tan(X/2);
: //----------------------------------------------
: if RadioButton2.checked then
: Tangent:=Edit3.Text;
: Radius:=Tangent/Tan(X/2);
: //***************************************
: I tried the following line but it still crashes.
: else
: ShowMessage('You forgot to check your selection)'

while (not RadioButton1.Checked) and
      (not RadioButton2.Checked) do begin
  ShowMessage('You forgot to check your selection');
  Application.ProcessMessages; 
end;
   
if RadioButton1.Checked then begin
  Radius := Edit2.Text;
  Tangent := Radius * Tan(X/2);
end
else begin
  Tangent :=Edit3.Text;
  Radius := Tangent / Tan(X/2);
end;

Good luck!
webmaster Guido

Related Articles and Replies