Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Select One Item at a time CheckBoxList

Select One Item at a time CheckBoxList

Scheduled Pinned Locked Moved C#
tutorial
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    omlac
    wrote on last edited by
    #1

    does anyone know how to select one item at a time from checkboxlist control. if one item is selected and i select a second item i want the first one to be deselected.

    A L C 3 Replies Last reply
    0
    • O omlac

      does anyone know how to select one item at a time from checkboxlist control. if one item is selected and i select a second item i want the first one to be deselected.

      A Offline
      A Offline
      AtulRane
      wrote on last edited by
      #2

      you have to check it at run time, whether another checkbox is checked or not, If any one is checked just Unchecked it by changing its value. Regards, Atul Rane

      modified on Wednesday, August 20, 2008 3:14 AM

      1 Reply Last reply
      0
      • O omlac

        does anyone know how to select one item at a time from checkboxlist control. if one item is selected and i select a second item i want the first one to be deselected.

        L Offline
        L Offline
        lisan_al_ghaib
        wrote on last edited by
        #3

        Hello ! There is an enum type property in CheckedListBox control : 'SelectionMode' You have to set it to 'One' But You have to think about usability! When we say a CheckedListBox, user have in mind that he can check more than one item! (CheckBox vs RadioButton) You will have user frustration as a result :sigh: The best control to use in this case is a simple ListBox. :)

        1 Reply Last reply
        0
        • O omlac

          does anyone know how to select one item at a time from checkboxlist control. if one item is selected and i select a second item i want the first one to be deselected.

          C Offline
          C Offline
          chaiguy1337
          wrote on last edited by
          #4

          You should use a radio button group for this, as that is the purpose of that control. If using Windows Forms, any radio button that is selected will automatically deselect any other radio buttons in the same enclosing container (such as a group box or panel). ...or a simple ListBox as lisan suggested.

          “Time and space can be a bitch.” –Gushie, Quantum Leap {o,o}.oO( Looking for a great RSS reader? Try FeedBeast! ) |)””’)            Built with home-grown CodeProject components! -”-”-

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups