<pre>nt amount = Convert.ToInt32(textBox1.Text.Trim()); for (int i = 2; i < dgv.Columns.Count; i++) { foreach (DataGridViewRow row in dgv.Rows) { int value = Convert.ToInt32(row.Cells[i].Value); if (amount >= value) amount = amount - value; else if (amount == 0) row.Cells[i].Value = amount; else { row.Cells[i].Value = amount; amount = 0; } } } if (amount > 0) { MessageBox.Show("Please check the amount"); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)