求大佬帮忙解决一下图上面的2个问题
3条回答 默认 最新
- 邱家健 2020-08-19 23:47关注
private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
{if (e.ColumnIndex==1) { string tmpFruit = string.Empty; tmpFruit = this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(); if (tmpFruit == "苹果") { sAppleCnt += 1; } if (tmpFruit == "橘子") { sOrangeCnt += 1; } if (tmpFruit == "梨") { sPearCnt += 1; } this.txtAppleCount.Text = sAppleCnt.ToString(); this.textBox1.Text = sPearCnt.ToString(); this.textBox2.Text = sOrangeCnt.ToString(); } }
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报