enter code here
我在网格中有两个单元格当我在另一个单元格中输入大于零值时,我想将一个单元格的颜色和值更改为零
private void grdDetail_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
{
if (this.IsLoadComplete)
{
UpdateValueofQtyCell(e.ColumnIndex);
}
}
private void UpdateValueofQtyCell(int index)
{
int cur_row = grdDetail.CurrentRow.Index;
if (index == 1)
{
grdDetail[1, cur_row].Style.BackColor = Color.White;
grdDetail[2, cur_row].Style.BackColor = Color.FromArgb(224, 224, 224);
grdDetail[2, cur_row].Value = 0;
}
else if (index == 1)
{
grdDetail[2, cur_row].Style.BackColor = Color.White;
grdDetail[1 cur_row].Style.BackColor = Color.FromArgb(224, 224, 224);
grdDetail[1, cur_row].Value = 0;
}
}