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. Visual Basic
  4. Update DataGridView Cell value [modified]

Update DataGridView Cell value [modified]

Scheduled Pinned Locked Moved Visual Basic
helpcssquestionannouncement
4 Posts 3 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.
  • J Offline
    J Offline
    Jay Royall
    wrote on last edited by
    #1

    Hi, I have a DataGridView control containing several columns one of which is a CheckBoxColumn. Clicking any of the CheckBoxes in this column fires the CellContentClick event which perfoms a task using the value of the clicked CheckBox. However, the value of the CheckBox doesn't seem to update until the cell loses focus, which is a problem for the task I am trying to achieve. Anybody help me on this one? Thanks. EDIT : Sorted it I think using the CommitEdit method of the grid.

    modified on Wednesday, August 5, 2009 7:46 AM

    J D 2 Replies Last reply
    0
    • J Jay Royall

      Hi, I have a DataGridView control containing several columns one of which is a CheckBoxColumn. Clicking any of the CheckBoxes in this column fires the CellContentClick event which perfoms a task using the value of the clicked CheckBox. However, the value of the CheckBox doesn't seem to update until the cell loses focus, which is a problem for the task I am trying to achieve. Anybody help me on this one? Thanks. EDIT : Sorted it I think using the CommitEdit method of the grid.

      modified on Wednesday, August 5, 2009 7:46 AM

      J Offline
      J Offline
      Johan Hakkesteegt
      wrote on last edited by
      #2

      Perhaps you can move the task from the CellContentClick event to the DataGrid's MouseUp event ? Determine which cell has been clicked there, and because MouseUp happens after the rest, the CheckBox value should be resolved and ready for you to use.

      My advice is free, and you may get what you paid for.

      1 Reply Last reply
      0
      • J Jay Royall

        Hi, I have a DataGridView control containing several columns one of which is a CheckBoxColumn. Clicking any of the CheckBoxes in this column fires the CellContentClick event which perfoms a task using the value of the clicked CheckBox. However, the value of the CheckBox doesn't seem to update until the cell loses focus, which is a problem for the task I am trying to achieve. Anybody help me on this one? Thanks. EDIT : Sorted it I think using the CommitEdit method of the grid.

        modified on Wednesday, August 5, 2009 7:46 AM

        D Offline
        D Offline
        dan sh
        wrote on last edited by
        #3

        In the CellContentClick event, you will get the updated value in the EditedFormattedValue property of the cell and not in the Value property.

        It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD

        J 1 Reply Last reply
        0
        • D dan sh

          In the CellContentClick event, you will get the updated value in the EditedFormattedValue property of the cell and not in the Value property.

          It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD

          J Offline
          J Offline
          Jay Royall
          wrote on last edited by
          #4

          Great, just what I was looking for - thanks :D

          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