Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6054187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:07:30+00:00 2026-05-23T08:07:30+00:00

I have a datagrid with 2 columns. One is a checkbox and one is

  • 0

I have a datagrid with 2 columns. One is a checkbox and one is a normal textbox cell. All is bound to one BindingList which is an entity.

If I check one checkbox and then loop to get the checked entities from the BindingList, it returns nothing. But if I check then edit the textbox column, it works just fine and return one result.

I tried to refresh or to check then click somewhere else. It doesn’t work.

How do you manage to get your bindingList updated when you check a column?

Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:07:30+00:00Added an answer on May 23, 2026 at 8:07 am

    What data type is the column in the data source (dataTable)? Is it boolean type?

    But this doesnt matter so much, what matters is that you use the correct event of the dgv.
    Use:
    1. CurrentCellDirtyStateChanged and
    2. CellValueChanged

    This is the code you have to use:

        private void CreateAndBind()
        {
            DataTable table = GetDataToDataTable();
            //then bind it to dgv:
            dgv.DataSource = new BindingSource(table, null);
            //create events for dgv:
            dgv.CurrentCellDirtyStateChanged += new EventHandler(dgv_CurrentCellDirtyStateChanged);
            dgv.CellValueChanged += new EventHandler(dgv_CellValueChanged);
        }
    
        private DataTable GetDataToDataTable()
        {
            //get data from dataBase, or what ever...   
            table.Columns.Add("column1", typeof(stirng));
            table.Columns.Add("column2", typeof(bool));
    
            //adding some exmaple rows:
            table.Rows.Add("item 1", true);
            table.Rows.Add("item 2", false);
            return table;
        }
    
        void dgv_CurrentCellDirtyStateChanged(object sender, EventArgs e)
        {
            if (dataGridView1.IsCurrentCellDirty)
                dataGridView1.CommitEdit(DataGridViewDataErrorContexts.Commit);
        }
    
        private void dgv_CellValueChanged(object obj, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 0) //compare to checkBox column index
            {
                DataGridViewCheckBoxCell check = dataGridView1[0, e.RowIndex] as DataGridViewCheckBoxCell;
                if (Convert.ToBoolean(check.Value) == true)
                {
                    //If tick is added!
                    //
                }
            }
        }
    

    Hope it helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a dynamic DataGrid in which one of the columns is a CheckBox.
We have a Flex DataGrid with 3 columns of which one of them has
I have a DataGrid (the official one) with SelectionUnit=Cell . When the user selects
I have a DataGrid in my WPF window which is bound to a database.
I have a DataGrid in Flex, with one column a checkbox and another a
I have a GWT 2.4 DataGrid associated with a SingleSelectionModel. One of the columns
I have a datagrid with 2 columns. One column contains role information, the other
I have a datagrid which I am using LINQ to fill, I then add
I have wpf datagrid, in one of columns, I checkboxes added in it, now
I have one Datagrid in Flex. In datagrid there are 4 columns like mark1,mark2,mark3,Total.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.