Link to home
Start Free TrialLog in
Avatar of bdb12
bdb12

asked on

VB radio button deselect

Easy question, pretty much what the title says.

Have a reset button on a form and I want the previously selected radio button to become unselected.

Anyone know how?
Avatar of appari
appari
Flag of India image

try

radiobutton.value=false
Avatar of bdb12
bdb12

ASKER

Nah value is not a member of the class
ASKER CERTIFIED SOLUTION
Avatar of JackOfPH
JackOfPH
Flag of Philippines image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Private Sub ResetRadioButton()

Dim rd As RadioButton
        For Each ctrl As Control In Me.Controls
            If TypeOf (ctrl) Is RadioButton Then
                rd = ctrl
                If rd.Checked = True Then
                    rd.Checked = False
                End If
            End If
        Next

end sub
are you using vb.net?
this zone is for vb6.0 or earlier versions.
Just call the sub procedure like this:
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click

'****This call the sub ResetRadioButton posted earlier *******

ResetRadioButton()

End sub
Avatar of bdb12

ASKER

Cool checked() is what I was after.

Thanks for the tips with the radiobutton reset function - that's really handy