i'm developing an application using c# i've add two checkboxes in the datagridview. i want them to act like two radio buttons. if first checkbox is checked the other one is unchecked automatically i tried some code but did't work for me.
private void datagridSB_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex == 15)
{
if (Convert.ToBoolean(datagridSB.CurrentRow.Cells[15].Value = true))
{
datagridSB.CurrentRow.Cells[17].Value = false;
//uncheck the second checkbox
}
else if (Convert.ToBoolean(datagridSB.CurrentRow.Cells[15].Value = false))
{
datagridSB.CurrentRow.Cells[17].Value = true;
//check the second checkbox
}
}
if (e.ColumnIndex == 17)
{
if (Convert.ToBoolean(datagridSB.CurrentRow.Cells[17].Value = true))
{
datagridSB.CurrentRow.Cells[15].Value = false;
//uncheck the first checkbox
}
else if (Convert.ToBoolean(datagridSB.CurrentRow.Cells[17].Value = false))
{
datagridSB.CurrentRow.Cells[15].Value = true;
//check the first checkbox
}
}
}
it's not working any help please
Aucun commentaire:
Enregistrer un commentaire