| | |
IF and ELSE procedures
Please support our Pascal and Delphi advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
0
#2 Oct 13th, 2009
one form,two radio buttons as radiobutton1 and radiobutton2 and a simple button as button1,place them onto the form and code the button1 as
this is it.....
delphi Syntax (Toggle Plain Text)
procedure TForm1.Button1Click(Sender: TObject); begin if radiobutton1.Checked = true then begin radiobutton2.Checked:=false; showmessage('radiobutton1 is selected'); end else begin showmessage('radiobutton2 is selected'); end; end;
Be a good part of the community.Don't be ungrateful.
If you ask something on the forum and you got the right answer then mark as solved!
If my opinion helped to you a lot then sometimes give reputation point to me.
I'm just a pascal programmer from Hungary.
Farewell...
If you ask something on the forum and you got the right answer then mark as solved!
If my opinion helped to you a lot then sometimes give reputation point to me.
I'm just a pascal programmer from Hungary.
Farewell...
0
#3 Oct 13th, 2009
or you can use case structure too 

by the way the If..then..else is a structure not procedure

delphi Syntax (Toggle Plain Text)
procedure TForm1.Button1Click(Sender: TObject); begin case radiobutton1.Checked of true:showmessage('radiobutton1 is selected'); false:showmessage('radiobutton1 is unchecked'); end; end;

by the way the If..then..else is a structure not procedure
Be a good part of the community.Don't be ungrateful.
If you ask something on the forum and you got the right answer then mark as solved!
If my opinion helped to you a lot then sometimes give reputation point to me.
I'm just a pascal programmer from Hungary.
Farewell...
If you ask something on the forum and you got the right answer then mark as solved!
If my opinion helped to you a lot then sometimes give reputation point to me.
I'm just a pascal programmer from Hungary.
Farewell...
•
•
Join Date: Oct 2009
Posts: 10
Reputation:
Solved Threads: 3
0
#4 Oct 14th, 2009
•
•
•
•
Hi, i am trying to get my application to check, which radiobutton is selected, and then perform instructions based on the selection.
but i cant seem to use a IF and ELSE procedure to do this, can somebody help me out as to what procedure i should use.
Do a Radiogroup on click event and put in the following:
procedure TForm1.RGClick(Sender: TObject);
begin
CASE RG.itemindex OF
0 : { Do something }
1 : { Do Something else }
End;
end;
Alternatively you could trigger the case statement on the press of an apply or OK button.
Hope that helps
PQ
![]() |
Similar Threads
- Variable scope problem (C++)
- procedures and functions (C#)
- how can Stored procedures be used in oracle reports for creating reports? (Oracle)
- Procedures (Assembly)
- sscanf procedures (Pascal and Delphi)
- Triggers Loop or Stored Procedures Loop (MS SQL)
- PC Cleaning Procedures & Detection Tools (Viruses, Spyware and other Nasties)
- Calling Oracle Stored Procedures with ASP (ASP)
Other Threads in the Pascal and Delphi Forum
- Previous Thread: Connect to an Oracle database
- Next Thread: Incompatible Types TString and TCaption when using memos
| Thread Tools | Search this Thread |





