I added Checkboxcolumn near my columns. i googling a lot but i cant find a good answer.
I Want to make Btn_Edit.Visiable=false;
if checkbox checked count is up to 1. after my researches i go to Use CellContentClick event but it isn't work fine.
My Code:
private void GrdVw_Reception_CellContentClick_1(object sender, DataGridViewCellEventArgs e)
{
if (GrdVw_Reception.CurrentCellAddress.X == 0)
{
int UpTpOne = 0;
bool flag = false;
for (int i = 0; i < GrdVw_Reception.Rows.Count; i++)
{
if (Convert.ToBoolean(GrdVw_Reception.Rows[i].Cells["checkColumn"].Value) == true)
{
UpTpOne = UpTpOne + 1;
if (UpTpOne == 1)
{
flag = true;
}
else
{
flag = false;
}
}
}
if (flag == true)
{
Btn_Edit.Visible = true;
}
else
{
Btn_Edit.Visible = false;
}
}
}
In this step when i run the program and click on checkboxes for first Btn_Edit dont go to true and for secound click Btn_Edit.Visiable go to true.
I want checkedchange event or an event that when i click on checkbox go to event codes in that moment.
(Sorry for bad English)
Aucun commentaire:
Enregistrer un commentaire