Determining chosen radio button?

  • Thread starter Thread starter vince
  • Start date Start date
V

vince

Is there an easy way to determine which radio button in a
group has been chosen, besides having to put code in the
checkchanged or clicked event for each button in the
group...???

thanks,

vince
 
You can just put handle the CheckChanged event of the entire group.

radiobtn.CheckChanged (this would be the method)

And then in that method do something like this to see if it is checked:

void CheckChanged(object sender, EventArgs e)
{
RadioButton radioBtn = (RadioButton) sender;

if (radioBtn.Checked)
{
MessageBox.Show("Radio Button: " + radioBtn.Text + " is checked");
} // if (radioBtn.Checked)
}// void CheckChanged(object sender, EventArgs e)

This should work for you. You may have to check exact sytax since I just
typed this up quick from memory.

Jared Baszler
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top