HYPDM.WinUI.ProductsAndParts.Parts.PartsStructAddForm.dgv_productList_CellContentClick C# (CSharp) Method

dgv_productList_CellContentClick() private method

private dgv_productList_CellContentClick ( object sender, DataGridViewCellEventArgs e ) : void
sender object
e DataGridViewCellEventArgs
return void
        private void dgv_productList_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex != 0 || e.RowIndex == -1) return;
            for (int i = 0; i < dgv_productList.Rows.Count; i++)
            {
                DataGridViewCheckBoxCell checkcell = (DataGridViewCheckBoxCell)dgv_productList.Rows[i].Cells[0];
                if(e.RowIndex==i){
                    checkcell.Value = !Convert.ToBoolean(checkcell.Value);
                }else{
                    checkcell.Value=false;
                }
            }
        }