Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 884847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:48:39+00:00 2026-05-15T12:48:39+00:00

Possible Duplicate: Using ApplicationSettings to store Checked property for WinForms RadioButtons I have three

  • 0

Possible Duplicate:
Using ApplicationSettings to store Checked property for WinForms RadioButtons

I have three radiobuttons in a groupbox. When they are not bound to application settings, they behave normally.

After binding each of their checked properties to application settings, the following happens: I have to click an unchecked radiobutton two times to have it checked. After the first click, all three are unchecked.

I also tried binding only two of them, but the behaviour is the same.

Can anyone please help with this?

Thanks.

I also asked on MSDN Visual Basic General Forum.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T12:48:40+00:00Added an answer on May 15, 2026 at 12:48 pm

    You can add the following event handler to the Click event of each of the three RadioButtons (of which the Checked properties are bound to Application Settings) in your GroupBox:

    Private Sub RadioButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tomRadioButton.Click, dickRadioButton.Click, harryRadioButton.Click
        If sender.Checked = False Then
            sender.Checked = True
        End If
    End Sub
    

    It works, even though it takes a half-second for an unckecked RadioButton to be checked after you click it.

    The reason for the problem was explained two years ago (in 2008) in section 5 of the Surviving WinForms Databinding post on the Turbulent Intelect blog (Thank you, ohadsc, for the link):

    Rule 5: Don’t bind to clickable Radio Buttons

    I know how great it would be if you
    could just bind your bunch of radio
    buttons to an enum property. I really
    do. You think you’re just going to
    hook up some Format and Parse events
    to translate back to your enum, and
    all will be well. It would be so darn
    convenient, if it actually worked. But
    WinForms just isn’t cut out for this.
    For 3 full releases now (or is it 3.5
    releases?), this has been the case.
    It’s because of the event order, which
    is not something that MS can go
    switching up without causing thousands
    of developers to get really cheesed
    off.

    The problem really comes down to the
    fact that unlike other controls’ data
    properties, the Checked property of a
    radio button doesn’t actually change
    until focus leaves the radio button.
    And as with all WinForms controls the
    focus doesn’t actually leave the radio
    button until after focus is given to
    another control, and in fact not until
    after the Click event of the newly
    focused control has fired. The result
    of this, as it pertains to radio
    buttons, is that if you try to bind to
    them, the bound properties in your
    datasource will actually lag your
    radio buttons’ visual state by one
    click
    . If you have just two radio
    buttons, the datasource will be
    exactly opposite the visible state,
    until you click somewhere else that
    doesn’t trigger an action that
    references those datasource
    properties. Which can make this a
    really infuriating bug to track down.
    I almost thought I was hallucinating.

    Now, in all honesty, it’s possible to
    make it work. But it is the kludgiest
    kludge that ever kludged. Okay maybe
    it’s not that bad… but it’s a messy
    hack for sure. It takes a lot of work
    for something that really should
    already be available. As near as I can
    tell, the only way to solve this
    problem without giving up the
    databinding mechanism is to
    essentially make your own RadioButton
    control, with a property change and
    event order that is actually useful.
    You can either write one from scratch,
    or sub-class RadioButton and override
    all the event logic with custom
    message handling.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.