PDA

View Full Version : مجموع datagridview



ameysams
شنبه 31 شهریور 1386, 09:38 صبح
با سلام در یک datagridview چگونه میتوان در یک سلول جمع این سلول با سلول بالایی
خودش را بدست آورد؟ با تشکر

MH2538
شنبه 31 شهریور 1386, 12:43 عصر
سلام
نمونه کد:


dataGridView1.Rows[2].Cells[5].Value = Convert.ToInt32(dataGridView1.Rows[2].Cells[5].Value) + Convert.ToInt32(dataGridView1.Rows[1].Cells[5].Value);

یا


dataGridView1.CurrentRow.Cells[5].Value = Convert.ToInt32(dataGridView1.CurrentRow.Cells[5].Value) + Convert.ToInt32(dataGridView1.Rows[dataGridView1.CurrentRow.Index - 1].Cells[5].Value);