hi
i have a WinForm with DataGridViewControll.

one of the datagrid columns is a DataGridViewCheckBoxColumn.

how can i Check or uncheck the Checkbox column of a certain row ?

In this example, the CellValueChanged event is used to examine the cell when the value is changed. For your question, extract the code you need and just substitute the row and column indexes to refer to the known cell, which will allow you to "get" or "set" the Value property to be true or false (checked or unchecked).

// Occurs when the value is changed...
                private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
                {
                    int iCol = e.ColumnIndex;
                    int iRow = e.RowIndex;
                    if (iRow > -1 & iCol > -1)
                    {
                        if (dataGridView1.Rows[iRow].Cells[iCol].ValueType == typeof(bool))
                        {
                            bool bChecked = (bool)dataGridView1.Rows[iRow].Cells[iCol].Value;
                        }
                    }
                }

Edited 7 Years Ago by DdoubleD: n/a

This question has already been answered. Start a new discussion instead.