Click here to Skip to main content
15,886,422 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
hello every body,,

i add a check box column in datagrid view.
i want user should check only one check box (i.e select one record at a time)
i used cell click event
private void myDataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
{

DataGridViewCheckBoxCell Check = (DataGridViewCheckBoxCell)myDataGridView.Rows[e.RowIndex].Cells[0];
if (Check.Value != null)
{
if (Check.Value == "True")
{
int r = e.RowIndex;
}
}
else
return;
}
but as i select/tick any check box it take value as null why?
i set the true value to True & FalseValue to false of datagrid view's column of CheckBox.

if u know this plz tell me
Posted

1 solution

archana_Kalyankar wrote:
Check.Value == "True")


Try something like Check.Checked = true;.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900