DataGridView を持つアプリケーションを構築していますが、プログラムの実行中に特定の行と列の値を更新する必要がある場合があります。この値には、アイテムの数量に関連するデータが含まれているためです。
たとえば、次の DataGridView があるとします。
0 1
+----------+----------+
| Item | Quantity |
+----------+----------+
0 | Candy L | 1 |
+----------+----------+
行 0 と列 1 に +1 を追加する必要があります。したがって、結果としてこれが得られます。
0 1
+----------+----------+
| Item | Quantity |
+----------+----------+
0 | Candy L | 2 |
+----------+----------+
私はすでにいくつかのことをしました:
int rowIndex = 0;
foreach (DataGridViewRow dgvRow in dataGridViewLista.Rows)
{
if (dgvRow.Cells[0].FormattedValue.ToString() == "Candy")
// Here I'd update the row (at this point I already have the row index)
rowIndex++;
}
ありがとう。