我有一個DataGridView,並希望更新一個標籤與行的SUM,因爲我在該特定列(逐行)中輸入值。它基本上是一個發票生成gridView。我需要不斷更新總金額標籤,因爲我在物品價格中輸入了gridview。我正在嘗試使用cellLeave事件,因爲我希望一旦離開單元格並進入下一行就更新數量。但事件不是射擊..真的需要幫助!我使用此代碼:c#dataGridView cellLeave事件不發射
private void dataGridView1_CellLeave(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex == 2)
{
Double result = 0;
foreach (DataGridViewRow row in this.dataGridView1.Rows)
{
result += Convert.ToDouble(row.Cells[2].Value);
}
this.label3.Text = result.ToString();
}
}
事件沒有解僱或您的代碼無法正常工作? – Anuraj 2015-03-19 09:52:11
事件不會觸發..我的意思是如果我輸入值,標籤不會更新。 – spdif 2015-03-19 09:55:42
輸入值__和___離開細胞?事件迷上了? – TaW 2015-03-19 10:02:19