enabling\disabling a radiobutton

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have several radio buttons for the user to choose from. I need to enable
or disable a particular radio button, depending on a certain condition.

How can I do this?

Thanks, Leonard
 
Hi Leonard,

I'm not sure what you mean. Unless you simply are looking for the Enabled property. Set the Enabled property to false for the RadioButton in question when you test the condition.
 
Sorry, I should have been more clear. I don't want to disable all of the
radio buttons in the group, only a single one in the collection.
 
As Morten says, you just disable the specific radiobutton. F.x. if we
have 3 radiobuttons (rb1, rb2, rb3) in a groupbox (grp_radiobuttons)
and you want to disable rb2, then you just write rb2.enabled = false.
 
I apologize. I'm kind of new at this. I have just discovered the control
the radio buttons are on are a radiobuttonlist control. Should I make them
radio buttons and put them in a group box? The help indicates it is easier
to determine which one was selected, in a radiobuttonlist control.
 
I'm afraid I'm not familiar with the RadioButtonList (for future reference indicate if the control in question is a web control as they differ somewhat from windows controls), but I don't think you can enable a single RadioButton in that list. You can as you say use individual RadioButtons in a container control like a GroupBox and enable and disable them as you like.
 
Back
Top