By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,146 Members | 1,631 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,146 IT Pros & Developers. It's quick & easy.

Binding to a Radio Button in Windows Forms

P: n/a

I have radio buttons bound to boolean properties in a business object.

private void bindRadioButton(RadioButton button, string
Binding binding = button.DataBindings.Add("Checked",
binding.ControlUpdateMode =
button.Enabled = exclusionBindingSource.Count 0;

When I click on another radio button, the radio group is cleared
instead of checking the radio button I clicked on. I have to double
click on a radio button to switch it.

I know why this is happening: since my radio buttons are updated
automatically by the data source (i.e., my business object), when I
click off a radio button, no booleans are set. This makes the radio
button group cleared before the clicked-on radio button has a chance
to modify the business object.

Is there a way to get around this?

In time it is happening like this:

1) The ex-checked button realizes it is no longer checked.
2) The ex-checked button updates the data source.
3) The interface realizes a change in the data source and updates the
interface to clear the group.
4) The clicked-on button never gets set because the interface already
cleared the group.
5) I cry a lot and stomp my feet.

Any ideas how to get around this?


Oct 18 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.