selecting and de-selection of radio button in vb

Posted on 2004-10-27
Last Modified: 2010-04-17
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!!!
Question by:subrata_das6478
    LVL 13

    Expert Comment

    If myradio.value Then
        myradio.value = False
        myradio.value = True
    End If
    LVL 3

    Accepted Solution

    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,
    LVL 19

    Assisted Solution

    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.

    Assisted Solution

    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.
    LVL 3

    Expert Comment

    I think dividing the points between RanjeetRain, Marc Johnston and myself is appropriate.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Anonabox PRO Tor & VPN Router

    PRO is the most advanced way to fortify your privacy and online anonymity by layering the Tor network with VPN services. Use both together or separately, and without needing to download software onto your devices.

    Suggested Solutions

    Title # Comments Views Activity
    countXY challenge 28 73
    maven archtype selection in eclipse 1 42
    Hibernate methods 2 33
    fix34  challenge 9 49
    This article is filled with multiple code samples and explanations for mathematical calculations. They are as follows: 1. General tips 2. Quadratic formula 3. Object collision 4. Projectile path General Tips       Here are some of my tips f…
    Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

    856 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now