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. DataGridView, CheckBoxes and ThreeState

DataGridView, CheckBoxes and ThreeState

Scheduled Pinned Locked Moved C#
helpquestionannouncement
1 Posts 1 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.
  • S Offline
    S Offline
    Steven Kirk
    wrote on last edited by
    #1

    Hello, I have a DataGridView with a DataGridViewCheckBoxColumn. I want to be able to have the checkbox display in an indeterminate state, so I've set the ThreeState property to True. However, I want the indeterminate state to only be set programatically - whenever the user clicks the checkbox, it should only toggle between Checked and Unchecked. Now, this is the default behaviour of a standard CheckBox control - as detailed in the CheckBox.ThreeState property documentation: "the CheckState property value can only be set to the Indeterminate value of System.Windows.Forms.CheckState in code and not by user interaction" How would I achieve this with DataGridView? I'm committing the changes to the checkbox cells immediately by catching the CurrentCellDirtyStateChanged event and calling CommitEdit as suggested in the documentation for DataGridView. However, if I try catching the indeterminate state in this event or in CellValueChanged, and setting Value to CheckState.Unchecked, the cell's Value property changes but the display does not update until the control loses focus or another row is selected. As this is the default for the CheckBox control, I'm sure it can't be that difficult to get the DataGridView to do it. What am I missing? Thanks in advance for your help, Steven

    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