Deselect all radio buttons in a group - VB2005

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • liltwese
    New Member
    • Feb 2008
    • 1

    Deselect all radio buttons in a group - VB2005

    Hi, i'm new to VB. I have a problem with de-selecting radio buttons in group box containers. I've tried to set focus to other objects under Sub New (initialization ) but it didn't work. The rdo buttons were still selected.

    I've tried setting this: rdoName.Checked = False, as well, that didn't work. For some reason the top radio button in the group box is always selected!

    I've also tried setting the rdoName.AutoChe ck = False. That works. The radio button at start up aren't selected but when i try to click on the rdo button, it won't let me.

    So i need the radio button to be deselected in the group box and let me be able to click on it when i want to.

    Someone help please.
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    I'm not sure you can de-select all radio buttons in a group. Their whole purpose is to choose between mutually exclusive options. I think the standard technique is, where required, to include a "null option" in the group. For example, the first or last option might be "None".

    Hm... now that I'm thinking about it, I seem to recall someone mentioning a property which allows you to specify whether all the radio buttons in a group can be unselected. I don't recall what the property is, but have a look through the properties on the "group box container" as well as the radio button(s).

    (I can't check it, as I'm using VB6 which works differently.)

    Comment

    • jamesd0142
      Contributor
      • Sep 2007
      • 471

      #3
      RadioButton1.Ch ecked = False

      That seems to do the trick for me...

      James

      Comment

      • TPishek
        New Member
        • Feb 2009
        • 1

        #4
        I had the same problem, which is actually how I ended up here...

        Anyway, I solved it, in mine at least. RadioButton1's default setting for Checked is False, but for some reason when I debugged it, it came up checked anyway until I changed the property to True and then back to False again.

        I have no idea why.

        Comment

        • RizalAziz
          New Member
          • Jul 2010
          • 1

          #5
          Please use CheckBox instead of radio/optionbox.

          Comment

          Working...