Computer Hope

Software => Computer programming => Topic started by: zaryk on April 05, 2008, 07:43:05 PM

Title: c# if radio button select then
Post by: zaryk on April 05, 2008, 07:43:05 PM
I have a radio button that is selected with

Code: [Select]
InitializeComponent();
docuMents.Select();

I would put more code under it, but im stuck with trying to figure how to do an if(docuMents is selected){}.  Can anyone help?
Title: Re: c# if radio button select then
Post by: Sidewinder on April 06, 2008, 06:28:08 AM
I don't know much about C# but I would think a radio button would have a checked property.

Code: [Select]
if radiobutton.checked then ...

What software are you using for your program development?

 8)
Title: Re: c# if radio button select then
Post by: zaryk on April 06, 2008, 06:27:45 PM
Im using sharpdevelop.....radiobutton.select does select it like I want it too, i suppose i can try using checked but either way I dont have a problem selecting it, just a problem writing an if/then statement for it.
Title: Re: c# if radio button select then
Post by: Sidewinder on April 06, 2008, 06:40:05 PM
I'm thinking select is a method, checked is a property. Use the checked property (true/false) to determine the status of the radio button.

Not sure of the syntax but something like:

if radiobutton.checked = true then do something
if radiobutton.checked = false then do somethingelse

Does SharpDevelop have intellisense or auto-completion? That might prove helpful on listing the properties and methods for a radiobutton.

 8)

Title: Re: c# if radio button select then
Post by: zaryk on April 07, 2008, 02:46:51 AM
cool thanks.....this worked

Code: [Select]
docuMents.Select();

if (docuMents.Checked = true){