Home > DeveloperSection > Forums > check and uncheck function in datagridview in c#
marcel ethan
marcel ethan

Total Post:105

Points:735
Posted on    January-04-2013 3:52 AM

 C# C# 
Ratings:


 1 Reply(s)
 1291  View(s)
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


AVADHESH PATEL

Total Post:604

Points:4228
Posted on    January-04-2013 7:37 AM

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.

Don't want to miss updates? Please click the below button!

Follow MindStick