• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 230
  • Last Modified:

selecting and de-selection of radio button in vb

I want to make the radio button as toggle button. means when i selects that first time and select it second time it should be de-selected on clicking it.
Pls provide code in VB
its urgent!!!
0
subrata_das6478
Asked:
subrata_das6478
3 Solutions
 
nurbekCommented:
If myradio.value Then
    myradio.value = False
Else
    myradio.value = True
End If
0
 
stu_pbCommented:
In this case, why not use a checkbox.  Radio buttons are used when one item must always be selected, checkboxes are used to toggle an on/off state.

If you have a few items where only one can be selected or none can be selected you could use checkboxes, then in the OnClick handler of each checkbox, you can turn off the other checkboxes using checkbox2.value = false and so on.

Good luck,
0
 
RanjeetRainCommented:
Not possible. By definition, a radio set is a "one of many" choice. Once you have selected it, you can unselect it. They only workaround can be to your checkboxes.
0
 
Marc_JohnstonCommented:
Again not possible.  VB automatically turns on the radio button that is clicked.  There are no events that occur AFTER the radio button has been turned on automatically to allow you to turn it off.  The best solution is to simple add another radio button selection for the Off option.
0
 
stu_pbCommented:
I think dividing the points between RanjeetRain, Marc Johnston and myself is appropriate.

Thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now