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?
Have a reset button on a form and I want the previously selected radio button to become unselected.
Anyone know how?
ASKER
Nah value is not a member of the class
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
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.
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
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
ASKER
Cool checked() is what I was after.
Thanks for the tips with the radiobutton reset function - that's really handy
Thanks for the tips with the radiobutton reset function - that's really handy
radiobutton.value=false