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. How to check a DataGridViewCheckBoxCell?

How to check a DataGridViewCheckBoxCell?

Scheduled Pinned Locked Moved C#
questiontutorial
7 Posts 2 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.
  • P Offline
    P Offline
    printscreen12345
    wrote on last edited by
    #1

    I have inserted a DataGridViewCheckBoxColumn in a DataGridView. But whenever I click on its DataGridViewCheckBoxCell, the box is not checked. How do I check it? Is any event needed? dgvcbc = new System.Windows.Forms.DataGridViewCheckBoxColumn(); dgvcbc.HeaderText = "Check to delete"; dgvcbc.Name = "Check to delete"; dgvcbc.CellTemplate = new DataGridViewCheckBoxCell(); dataGridView1.Columns.Insert(0, dgvcbc); Thanks!

    N 1 Reply Last reply
    0
    • P printscreen12345

      I have inserted a DataGridViewCheckBoxColumn in a DataGridView. But whenever I click on its DataGridViewCheckBoxCell, the box is not checked. How do I check it? Is any event needed? dgvcbc = new System.Windows.Forms.DataGridViewCheckBoxColumn(); dgvcbc.HeaderText = "Check to delete"; dgvcbc.Name = "Check to delete"; dgvcbc.CellTemplate = new DataGridViewCheckBoxCell(); dataGridView1.Columns.Insert(0, dgvcbc); Thanks!

      N Offline
      N Offline
      Nader Elshehabi
      wrote on last edited by
      #2

      Hello The problem is for sure NOT in the code that you've posted. Are other columns in the DataGridView working too?!! Maybe you've set the eable to false by mistake or something. The above code should work fine!! Regards:rose:

      P 1 Reply Last reply
      0
      • N Nader Elshehabi

        Hello The problem is for sure NOT in the code that you've posted. Are other columns in the DataGridView working too?!! Maybe you've set the eable to false by mistake or something. The above code should work fine!! Regards:rose:

        P Offline
        P Offline
        printscreen12345
        wrote on last edited by
        #3

        Hi, There is only one DataGridViewCheckBoxColumn in the DataGridView. Other columns are mainly DataGridViewColumn and DataGridViewLinkColumn. The links work perfectly. You mentioned the setting problem. What do you think has been set to false by mistake? What is the code for that setting? Thanks again.

        N 1 Reply Last reply
        0
        • P printscreen12345

          Hi, There is only one DataGridViewCheckBoxColumn in the DataGridView. Other columns are mainly DataGridViewColumn and DataGridViewLinkColumn. The links work perfectly. You mentioned the setting problem. What do you think has been set to false by mistake? What is the code for that setting? Thanks again.

          N Offline
          N Offline
          Nader Elshehabi
          wrote on last edited by
          #4

          Hello Well, as I told you in my previous post, this code should work!! You can tamper with the settings of your DataGridView in a way that it may stop responding. I gave you an example. Check the Enable prpperty of your DataGidView. Also check to see if you've made this column as ReadOnly. You can check both from the property grid. When I asked about other columns, I meant are they working in any how?? Can you edit the cells??

          Regards:rose:

          P 1 Reply Last reply
          0
          • N Nader Elshehabi

            Hello Well, as I told you in my previous post, this code should work!! You can tamper with the settings of your DataGridView in a way that it may stop responding. I gave you an example. Check the Enable prpperty of your DataGidView. Also check to see if you've made this column as ReadOnly. You can check both from the property grid. When I asked about other columns, I meant are they working in any how?? Can you edit the cells??

            Regards:rose:

            P Offline
            P Offline
            printscreen12345
            wrote on last edited by
            #5

            Hi, Do you mean the dataGridView.Enabled property? But it is set to true which allows user interaction. And the CheckBoxColumn isn't set to ReadOnly. So what else should I check? Thanks!

            N 1 Reply Last reply
            0
            • P printscreen12345

              Hi, Do you mean the dataGridView.Enabled property? But it is set to true which allows user interaction. And the CheckBoxColumn isn't set to ReadOnly. So what else should I check? Thanks!

              N Offline
              N Offline
              Nader Elshehabi
              wrote on last edited by
              #6

              Hello Well, err... Yes! Forgive the typo. I mean Enabled.. I'm running out of guesses here. Try to add another CheckboxColumn, and see what happens. Also you didn't answer my question. Do other Text columns work? Can you type in them?

              Regards:rose:

              P 1 Reply Last reply
              0
              • N Nader Elshehabi

                Hello Well, err... Yes! Forgive the typo. I mean Enabled.. I'm running out of guesses here. Try to add another CheckboxColumn, and see what happens. Also you didn't answer my question. Do other Text columns work? Can you type in them?

                Regards:rose:

                P Offline
                P Offline
                printscreen12345
                wrote on last edited by
                #7

                Hi, It's working now. I found out that the datagridview is readonly though I checked that the checkboxcolumn is not readonly. Anyways, thanks very much for your help.

                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