show-notice
hide-notice

Monday, 1 July 2013

at a time only one check box should be selected in a particular row


Introduction

Here I will explain at a time only one check box should be selected in a particular row.

 

You can use CellEndEdit Event or CellLeave event

when ever you will leave the cell after doing edits this event will fire. In the following snippet Column1 is your first checkbox and Column2 is your other checkbox.




private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
{
if (Convert.ToBoolean(dataGridView1.Rows[e.RowIndex].Cells["Column1"].Value))
dataGridView1.Rows[e.RowIndex].Cells["Column2"].Value = false;
}

SHARE THIS POST   

0 comments :

Post a Comment

Design by Gohilinfotech | www.gohilinfotech.blogspot.com