CHECK AND UNCHECK FUNCTION IN DATAGRIDVIEW IN C#

marcel ethan

Total Post:105

Points:735
Posted by  marcel ethan
C# 
C#
 1556  View(s)
Ratings:
Rate this:
Hi every one,

I'm working on datagridview in windows form. I have used checkbox in our gridview. I have successfully added checkbox and it generated for every rows. But this check box not check and uncheck. Can you tell me functionality of check and unchecked  of checkbox ?

Thank in advanced
  1. AVADHESH PATEL

    Post:604

    Points:4228
    Re: check and uncheck function in datagridview in c#

    Hi Marcel Ethan

    You can used below code

    private void dgvControl_CellClick(object sender, DataGridViewCellEventArgs e)
    {
                if ((Convert.ToBoolean(dgvControl[0, e.RowIndex].Value) == false))
                            dgvControl.Rows[e.RowIndex].Cells["ckbSelect"].Value = true;
                else
                            dgvControl.Rows[e.RowIndex].Cells["ckbSelect"].Value = false;
    }

    I hope above code solve your problem.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!