How to uncheck other checkboxes by checking a checkbox?uncheck SelectAll if one of row is uncheckedWhat is a NullReferenceException, and how do I fix it?Syntax error in Insert into vb.net and access 2007Handle buttons dropdowns created dynamicallyI am facing an issue during inserting data through datagrid in databaseVB.net change text in button control with variableI need to get the text in TexBox in child Panel. Get error in code , line 4: Object reference not set to an instance of an objectVbnet Sql incorrect syntax near ')'How To Run Different User in vb.netConvert listbox to DataGridView

Why is carrying a heavy object more taxing on the body than pushing the same object on wheels?

Manager is asking me to eat breakfast from now on

Is it possible to target 2 allies with the Warding Bond spell using the Sorcerer's Twinned Spell metamagic option?

I want light controlled by one switch, not two

Are there foods that astronauts are explicitly never allowed to eat?

Align the contents of a numerical matrix when you have minus signs

When will the last unambiguous evidence of mankind disappear?

Will copper pour help on my single-layer PCB?

Should I have one hand on the throttle during engine ignition?

How was Luke's prosthetic hand in Episode V filmed?

Legendre Polynomial Integral over half space

Could a US citizen born through "birth tourism" become President?

How should I interpret a promising preprint that was never published in a peer-reviewed journal?

Improving an O(N^2) function (all entities iterating over all other entities)

"This used to be my phone number"

What could make large expeditions ineffective for exploring territory full of dangers and valuable resources?

How to get a type of "screech" on guitar

Do Australia and New Zealand have a travel ban on Somalis (like Wikipedia says)?

Why would word of Princess Leia's capture generate sympathy for the Rebellion in the Senate?

Term for future-tense technique that isn't exactly foreshadowing

Why did my "seldom" get corrected?

Why teach C using scanf without talking about command line arguments?

What's the physical meaning of the statement that "photons don't have positions"?

Locked-up DOS computer beeped on keypress. What mechanism caused that?



How to uncheck other checkboxes by checking a checkbox?


uncheck SelectAll if one of row is uncheckedWhat is a NullReferenceException, and how do I fix it?Syntax error in Insert into vb.net and access 2007Handle buttons dropdowns created dynamicallyI am facing an issue during inserting data through datagrid in databaseVB.net change text in button control with variableI need to get the text in TexBox in child Panel. Get error in code , line 4: Object reference not set to an instance of an objectVbnet Sql incorrect syntax near ')'How To Run Different User in vb.netConvert listbox to DataGridView






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















When I press the chkCP1, it unchecks chkYP but chkCP doesn't display its checked state2; I need to double click chkCP before it displays its checked state3.



I used these codes:



Private Sub chkCP_CheckedChanged(sender As Object, e As EventArgs) Handles chkCP.CheckedChanged
chkYP.Checked = False
End Sub

Private Sub chkYP_CheckedChanged(sender As Object, e As EventArgs) Handles chkYP.CheckedChanged
chkCP.Checked = False
End Sub


Figure 1: 1



Figure 2: 2



Figure 3: 3










share|improve this question



















  • 1





    Why not just use 2 Radiobutton controls. Inside their own container, they will remain mutually exclusive to each other.

    – Charles May
    Mar 26 at 14:11

















0















When I press the chkCP1, it unchecks chkYP but chkCP doesn't display its checked state2; I need to double click chkCP before it displays its checked state3.



I used these codes:



Private Sub chkCP_CheckedChanged(sender As Object, e As EventArgs) Handles chkCP.CheckedChanged
chkYP.Checked = False
End Sub

Private Sub chkYP_CheckedChanged(sender As Object, e As EventArgs) Handles chkYP.CheckedChanged
chkCP.Checked = False
End Sub


Figure 1: 1



Figure 2: 2



Figure 3: 3










share|improve this question



















  • 1





    Why not just use 2 Radiobutton controls. Inside their own container, they will remain mutually exclusive to each other.

    – Charles May
    Mar 26 at 14:11













0












0








0








When I press the chkCP1, it unchecks chkYP but chkCP doesn't display its checked state2; I need to double click chkCP before it displays its checked state3.



I used these codes:



Private Sub chkCP_CheckedChanged(sender As Object, e As EventArgs) Handles chkCP.CheckedChanged
chkYP.Checked = False
End Sub

Private Sub chkYP_CheckedChanged(sender As Object, e As EventArgs) Handles chkYP.CheckedChanged
chkCP.Checked = False
End Sub


Figure 1: 1



Figure 2: 2



Figure 3: 3










share|improve this question
















When I press the chkCP1, it unchecks chkYP but chkCP doesn't display its checked state2; I need to double click chkCP before it displays its checked state3.



I used these codes:



Private Sub chkCP_CheckedChanged(sender As Object, e As EventArgs) Handles chkCP.CheckedChanged
chkYP.Checked = False
End Sub

Private Sub chkYP_CheckedChanged(sender As Object, e As EventArgs) Handles chkYP.CheckedChanged
chkCP.Checked = False
End Sub


Figure 1: 1



Figure 2: 2



Figure 3: 3







vb.net






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 26 at 14:45









ZF007

2,0544 gold badges14 silver badges32 bronze badges




2,0544 gold badges14 silver badges32 bronze badges










asked Mar 26 at 11:34









John ObogneJohn Obogne

11 bronze badge




11 bronze badge







  • 1





    Why not just use 2 Radiobutton controls. Inside their own container, they will remain mutually exclusive to each other.

    – Charles May
    Mar 26 at 14:11












  • 1





    Why not just use 2 Radiobutton controls. Inside their own container, they will remain mutually exclusive to each other.

    – Charles May
    Mar 26 at 14:11







1




1





Why not just use 2 Radiobutton controls. Inside their own container, they will remain mutually exclusive to each other.

– Charles May
Mar 26 at 14:11





Why not just use 2 Radiobutton controls. Inside their own container, they will remain mutually exclusive to each other.

– Charles May
Mar 26 at 14:11












3 Answers
3






active

oldest

votes


















1














I would personally use radiobuttons for this as this is what they were intended to do. However, I have seen a time where the option was to select neither option like you can easily do with checkboxes. That being said, You should be able to achieve the desired result by just simply moving your original code into the click event of the checkboxes instead of the checkchanged event. The reason is that when you click one, it triggers the checkchanged event which sets it to false which in turn triggers that controls checkchanged event. Try replacing your original code with



Private Sub chkCP_Click(sender As Object, e As EventArgs) Handles chkCP.Click
chkYP.Checked = False
End Sub

Private Sub chkYP_Click(sender As Object, e As EventArgs) Handles chkYP.Click
chkCP.Checked = False
End Sub





share|improve this answer























  • Yes, this might do the trick. But I think that it fails in the rare case that the keyboard is used instead of the mouse...

    – Bart Hofland
    Mar 26 at 15:32











  • hmmm, I just tried it and tabbed to each checkbox and pressed the spacebar with the same result as clicking on it with a mouse pointer.

    – Charles May
    Mar 26 at 18:51











  • Ah. Then it's fine. I was not sure. So the click event also fires for checkboxes when the spacebar is pressed. That's good to know. Thanks for checking. In that case, your answer is more elegant than mine. :)

    – Bart Hofland
    Mar 26 at 19:13


















0














edit:
I tried using if statements and it worked! However, I cannot uncheck the checkbox anymore.



Private Sub chkCP_CheckedChanged(sender As Object, e As EventArgs) Handles chkCP.CheckedChanged
If chkYP.Checked = True Then
chkYP.Checked = False
Else
chkCP.Checked = True
End If
End Sub

Private Sub chkYP_CheckedChanged(sender As Object, e As EventArgs) Handles chkYP.CheckedChanged
If chkCP.Checked = True Then
chkCP.Checked = False
Else
chkYP.Checked = True
End If
End Sub





share|improve this answer























  • Please add these details to your original post and remove this answer.

    – Çöđěxěŕ
    Mar 26 at 12:34


















0














You might have some issues with recursive event handlers here. If you set chkYP.Checked in chkCP_CheckedChanged, chkYP_CheckedChanged will be triggered. This sets chkCP.Checked, which triggers chkCP_CheckedChanged again.



You might try something like this:



Private _checking As Boolean

Private Sub chkCP_CheckedChanged(sender As Object, e As EventArgs) Handles chkCP.CheckedChanged
If Not _checking Then
_checking = True
chkYP.Checked = False
_checking = False
End If
End Sub

Private Sub chkYP_CheckedChanged(sender As Object, e As EventArgs) Handles chkYP.CheckedChanged
If Not _checking Then
_checking = True
chkCP.Checked = False
_checking = False
End If
End Sub


It may not win a beauty contest, but it might just do the job.



Using Radio Buttons might be a better solution if you want only one of N options selected.



Edit:
Charles May's answer is way more elegant. He handles the Click event instead of the CheckedChanged event. And that also seems to work fine when using the keyboard (pressing the spacebar to toggle the checkbox).






share|improve this answer



























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55356161%2fhow-to-uncheck-other-checkboxes-by-checking-a-checkbox%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    I would personally use radiobuttons for this as this is what they were intended to do. However, I have seen a time where the option was to select neither option like you can easily do with checkboxes. That being said, You should be able to achieve the desired result by just simply moving your original code into the click event of the checkboxes instead of the checkchanged event. The reason is that when you click one, it triggers the checkchanged event which sets it to false which in turn triggers that controls checkchanged event. Try replacing your original code with



    Private Sub chkCP_Click(sender As Object, e As EventArgs) Handles chkCP.Click
    chkYP.Checked = False
    End Sub

    Private Sub chkYP_Click(sender As Object, e As EventArgs) Handles chkYP.Click
    chkCP.Checked = False
    End Sub





    share|improve this answer























    • Yes, this might do the trick. But I think that it fails in the rare case that the keyboard is used instead of the mouse...

      – Bart Hofland
      Mar 26 at 15:32











    • hmmm, I just tried it and tabbed to each checkbox and pressed the spacebar with the same result as clicking on it with a mouse pointer.

      – Charles May
      Mar 26 at 18:51











    • Ah. Then it's fine. I was not sure. So the click event also fires for checkboxes when the spacebar is pressed. That's good to know. Thanks for checking. In that case, your answer is more elegant than mine. :)

      – Bart Hofland
      Mar 26 at 19:13















    1














    I would personally use radiobuttons for this as this is what they were intended to do. However, I have seen a time where the option was to select neither option like you can easily do with checkboxes. That being said, You should be able to achieve the desired result by just simply moving your original code into the click event of the checkboxes instead of the checkchanged event. The reason is that when you click one, it triggers the checkchanged event which sets it to false which in turn triggers that controls checkchanged event. Try replacing your original code with



    Private Sub chkCP_Click(sender As Object, e As EventArgs) Handles chkCP.Click
    chkYP.Checked = False
    End Sub

    Private Sub chkYP_Click(sender As Object, e As EventArgs) Handles chkYP.Click
    chkCP.Checked = False
    End Sub





    share|improve this answer























    • Yes, this might do the trick. But I think that it fails in the rare case that the keyboard is used instead of the mouse...

      – Bart Hofland
      Mar 26 at 15:32











    • hmmm, I just tried it and tabbed to each checkbox and pressed the spacebar with the same result as clicking on it with a mouse pointer.

      – Charles May
      Mar 26 at 18:51











    • Ah. Then it's fine. I was not sure. So the click event also fires for checkboxes when the spacebar is pressed. That's good to know. Thanks for checking. In that case, your answer is more elegant than mine. :)

      – Bart Hofland
      Mar 26 at 19:13













    1












    1








    1







    I would personally use radiobuttons for this as this is what they were intended to do. However, I have seen a time where the option was to select neither option like you can easily do with checkboxes. That being said, You should be able to achieve the desired result by just simply moving your original code into the click event of the checkboxes instead of the checkchanged event. The reason is that when you click one, it triggers the checkchanged event which sets it to false which in turn triggers that controls checkchanged event. Try replacing your original code with



    Private Sub chkCP_Click(sender As Object, e As EventArgs) Handles chkCP.Click
    chkYP.Checked = False
    End Sub

    Private Sub chkYP_Click(sender As Object, e As EventArgs) Handles chkYP.Click
    chkCP.Checked = False
    End Sub





    share|improve this answer













    I would personally use radiobuttons for this as this is what they were intended to do. However, I have seen a time where the option was to select neither option like you can easily do with checkboxes. That being said, You should be able to achieve the desired result by just simply moving your original code into the click event of the checkboxes instead of the checkchanged event. The reason is that when you click one, it triggers the checkchanged event which sets it to false which in turn triggers that controls checkchanged event. Try replacing your original code with



    Private Sub chkCP_Click(sender As Object, e As EventArgs) Handles chkCP.Click
    chkYP.Checked = False
    End Sub

    Private Sub chkYP_Click(sender As Object, e As EventArgs) Handles chkYP.Click
    chkCP.Checked = False
    End Sub






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Mar 26 at 14:36









    Charles MayCharles May

    1,5871 gold badge9 silver badges18 bronze badges




    1,5871 gold badge9 silver badges18 bronze badges












    • Yes, this might do the trick. But I think that it fails in the rare case that the keyboard is used instead of the mouse...

      – Bart Hofland
      Mar 26 at 15:32











    • hmmm, I just tried it and tabbed to each checkbox and pressed the spacebar with the same result as clicking on it with a mouse pointer.

      – Charles May
      Mar 26 at 18:51











    • Ah. Then it's fine. I was not sure. So the click event also fires for checkboxes when the spacebar is pressed. That's good to know. Thanks for checking. In that case, your answer is more elegant than mine. :)

      – Bart Hofland
      Mar 26 at 19:13

















    • Yes, this might do the trick. But I think that it fails in the rare case that the keyboard is used instead of the mouse...

      – Bart Hofland
      Mar 26 at 15:32











    • hmmm, I just tried it and tabbed to each checkbox and pressed the spacebar with the same result as clicking on it with a mouse pointer.

      – Charles May
      Mar 26 at 18:51











    • Ah. Then it's fine. I was not sure. So the click event also fires for checkboxes when the spacebar is pressed. That's good to know. Thanks for checking. In that case, your answer is more elegant than mine. :)

      – Bart Hofland
      Mar 26 at 19:13
















    Yes, this might do the trick. But I think that it fails in the rare case that the keyboard is used instead of the mouse...

    – Bart Hofland
    Mar 26 at 15:32





    Yes, this might do the trick. But I think that it fails in the rare case that the keyboard is used instead of the mouse...

    – Bart Hofland
    Mar 26 at 15:32













    hmmm, I just tried it and tabbed to each checkbox and pressed the spacebar with the same result as clicking on it with a mouse pointer.

    – Charles May
    Mar 26 at 18:51





    hmmm, I just tried it and tabbed to each checkbox and pressed the spacebar with the same result as clicking on it with a mouse pointer.

    – Charles May
    Mar 26 at 18:51













    Ah. Then it's fine. I was not sure. So the click event also fires for checkboxes when the spacebar is pressed. That's good to know. Thanks for checking. In that case, your answer is more elegant than mine. :)

    – Bart Hofland
    Mar 26 at 19:13





    Ah. Then it's fine. I was not sure. So the click event also fires for checkboxes when the spacebar is pressed. That's good to know. Thanks for checking. In that case, your answer is more elegant than mine. :)

    – Bart Hofland
    Mar 26 at 19:13













    0














    edit:
    I tried using if statements and it worked! However, I cannot uncheck the checkbox anymore.



    Private Sub chkCP_CheckedChanged(sender As Object, e As EventArgs) Handles chkCP.CheckedChanged
    If chkYP.Checked = True Then
    chkYP.Checked = False
    Else
    chkCP.Checked = True
    End If
    End Sub

    Private Sub chkYP_CheckedChanged(sender As Object, e As EventArgs) Handles chkYP.CheckedChanged
    If chkCP.Checked = True Then
    chkCP.Checked = False
    Else
    chkYP.Checked = True
    End If
    End Sub





    share|improve this answer























    • Please add these details to your original post and remove this answer.

      – Çöđěxěŕ
      Mar 26 at 12:34















    0














    edit:
    I tried using if statements and it worked! However, I cannot uncheck the checkbox anymore.



    Private Sub chkCP_CheckedChanged(sender As Object, e As EventArgs) Handles chkCP.CheckedChanged
    If chkYP.Checked = True Then
    chkYP.Checked = False
    Else
    chkCP.Checked = True
    End If
    End Sub

    Private Sub chkYP_CheckedChanged(sender As Object, e As EventArgs) Handles chkYP.CheckedChanged
    If chkCP.Checked = True Then
    chkCP.Checked = False
    Else
    chkYP.Checked = True
    End If
    End Sub





    share|improve this answer























    • Please add these details to your original post and remove this answer.

      – Çöđěxěŕ
      Mar 26 at 12:34













    0












    0








    0







    edit:
    I tried using if statements and it worked! However, I cannot uncheck the checkbox anymore.



    Private Sub chkCP_CheckedChanged(sender As Object, e As EventArgs) Handles chkCP.CheckedChanged
    If chkYP.Checked = True Then
    chkYP.Checked = False
    Else
    chkCP.Checked = True
    End If
    End Sub

    Private Sub chkYP_CheckedChanged(sender As Object, e As EventArgs) Handles chkYP.CheckedChanged
    If chkCP.Checked = True Then
    chkCP.Checked = False
    Else
    chkYP.Checked = True
    End If
    End Sub





    share|improve this answer













    edit:
    I tried using if statements and it worked! However, I cannot uncheck the checkbox anymore.



    Private Sub chkCP_CheckedChanged(sender As Object, e As EventArgs) Handles chkCP.CheckedChanged
    If chkYP.Checked = True Then
    chkYP.Checked = False
    Else
    chkCP.Checked = True
    End If
    End Sub

    Private Sub chkYP_CheckedChanged(sender As Object, e As EventArgs) Handles chkYP.CheckedChanged
    If chkCP.Checked = True Then
    chkCP.Checked = False
    Else
    chkYP.Checked = True
    End If
    End Sub






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Mar 26 at 12:00









    John ObogneJohn Obogne

    11 bronze badge




    11 bronze badge












    • Please add these details to your original post and remove this answer.

      – Çöđěxěŕ
      Mar 26 at 12:34

















    • Please add these details to your original post and remove this answer.

      – Çöđěxěŕ
      Mar 26 at 12:34
















    Please add these details to your original post and remove this answer.

    – Çöđěxěŕ
    Mar 26 at 12:34





    Please add these details to your original post and remove this answer.

    – Çöđěxěŕ
    Mar 26 at 12:34











    0














    You might have some issues with recursive event handlers here. If you set chkYP.Checked in chkCP_CheckedChanged, chkYP_CheckedChanged will be triggered. This sets chkCP.Checked, which triggers chkCP_CheckedChanged again.



    You might try something like this:



    Private _checking As Boolean

    Private Sub chkCP_CheckedChanged(sender As Object, e As EventArgs) Handles chkCP.CheckedChanged
    If Not _checking Then
    _checking = True
    chkYP.Checked = False
    _checking = False
    End If
    End Sub

    Private Sub chkYP_CheckedChanged(sender As Object, e As EventArgs) Handles chkYP.CheckedChanged
    If Not _checking Then
    _checking = True
    chkCP.Checked = False
    _checking = False
    End If
    End Sub


    It may not win a beauty contest, but it might just do the job.



    Using Radio Buttons might be a better solution if you want only one of N options selected.



    Edit:
    Charles May's answer is way more elegant. He handles the Click event instead of the CheckedChanged event. And that also seems to work fine when using the keyboard (pressing the spacebar to toggle the checkbox).






    share|improve this answer





























      0














      You might have some issues with recursive event handlers here. If you set chkYP.Checked in chkCP_CheckedChanged, chkYP_CheckedChanged will be triggered. This sets chkCP.Checked, which triggers chkCP_CheckedChanged again.



      You might try something like this:



      Private _checking As Boolean

      Private Sub chkCP_CheckedChanged(sender As Object, e As EventArgs) Handles chkCP.CheckedChanged
      If Not _checking Then
      _checking = True
      chkYP.Checked = False
      _checking = False
      End If
      End Sub

      Private Sub chkYP_CheckedChanged(sender As Object, e As EventArgs) Handles chkYP.CheckedChanged
      If Not _checking Then
      _checking = True
      chkCP.Checked = False
      _checking = False
      End If
      End Sub


      It may not win a beauty contest, but it might just do the job.



      Using Radio Buttons might be a better solution if you want only one of N options selected.



      Edit:
      Charles May's answer is way more elegant. He handles the Click event instead of the CheckedChanged event. And that also seems to work fine when using the keyboard (pressing the spacebar to toggle the checkbox).






      share|improve this answer



























        0












        0








        0







        You might have some issues with recursive event handlers here. If you set chkYP.Checked in chkCP_CheckedChanged, chkYP_CheckedChanged will be triggered. This sets chkCP.Checked, which triggers chkCP_CheckedChanged again.



        You might try something like this:



        Private _checking As Boolean

        Private Sub chkCP_CheckedChanged(sender As Object, e As EventArgs) Handles chkCP.CheckedChanged
        If Not _checking Then
        _checking = True
        chkYP.Checked = False
        _checking = False
        End If
        End Sub

        Private Sub chkYP_CheckedChanged(sender As Object, e As EventArgs) Handles chkYP.CheckedChanged
        If Not _checking Then
        _checking = True
        chkCP.Checked = False
        _checking = False
        End If
        End Sub


        It may not win a beauty contest, but it might just do the job.



        Using Radio Buttons might be a better solution if you want only one of N options selected.



        Edit:
        Charles May's answer is way more elegant. He handles the Click event instead of the CheckedChanged event. And that also seems to work fine when using the keyboard (pressing the spacebar to toggle the checkbox).






        share|improve this answer















        You might have some issues with recursive event handlers here. If you set chkYP.Checked in chkCP_CheckedChanged, chkYP_CheckedChanged will be triggered. This sets chkCP.Checked, which triggers chkCP_CheckedChanged again.



        You might try something like this:



        Private _checking As Boolean

        Private Sub chkCP_CheckedChanged(sender As Object, e As EventArgs) Handles chkCP.CheckedChanged
        If Not _checking Then
        _checking = True
        chkYP.Checked = False
        _checking = False
        End If
        End Sub

        Private Sub chkYP_CheckedChanged(sender As Object, e As EventArgs) Handles chkYP.CheckedChanged
        If Not _checking Then
        _checking = True
        chkCP.Checked = False
        _checking = False
        End If
        End Sub


        It may not win a beauty contest, but it might just do the job.



        Using Radio Buttons might be a better solution if you want only one of N options selected.



        Edit:
        Charles May's answer is way more elegant. He handles the Click event instead of the CheckedChanged event. And that also seems to work fine when using the keyboard (pressing the spacebar to toggle the checkbox).







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Mar 26 at 19:20

























        answered Mar 26 at 15:02









        Bart HoflandBart Hofland

        1,5251 gold badge5 silver badges14 bronze badges




        1,5251 gold badge5 silver badges14 bronze badges



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55356161%2fhow-to-uncheck-other-checkboxes-by-checking-a-checkbox%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

            Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript