I am coding in C# using Visual Studio 2010 and have a form whereby I have two radio buttons and a textbox, that is:
o Radio button 1 "Yes"
o Radio button 2 "No" Textbox here
I want the form to load with the “Yes” radio button already selected, that is:
x Radio button 1 "Yes"
o Radio button 2 "No" Textbox here (grayed out "cannot input text")
By default, the textbox should not accept input. I want it such that if a user clicks and selects radio button 2 "No", the text box is now able to accept input.
How do I achieve this?
private void rb_taxable_yes_CheckedChanged(object sender, EventArgs e)
{
}
private void rb_taxable_no_CheckedChanged(object sender, EventArgs e)
{
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
On your
Formin design mode setEnabledtoFalsefor theTextBox, andCheckedtoTruefor the firstRadioButton.Attach both radiobuttons to one event handler: