TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Marvin kakuru
1.4k
356
160.2k
Datagridveiw column sum
Oct 7 2011 6:14 AM
Hi all,
I hope your all alright. I am designing a cash denomination calculator and below is the code I have used.
private
void
dataGridView1_CellValidated_1(
object
sender,
DataGridViewCellEventArgs
e)
{
DataGridViewRow
row = dataGridView1.Rows[e.RowIndex]
int
a = System.
Convert
.ToInt32(row.Cells[ColumnA.Index].Value);
int
b = System.
Convert
.ToInt32(row.Cells[ColumnB.Index].Value);
int
c = (a * b);
row.Cells[ColumnC.Index].Value = c.ToString(
"n0"
);
dataGridView1.Columns[
"ColumnB"
].Width = 170;
dataGridView1.Columns[
"ColumnC"
].Width = 200;
}
However I have failed to find a way of getting the sum of the values for all rows of column, Is there a way I can get the sum of all rows of a column of a datagridview and display it in a textbox.text or a label.text
Reply
Answers (
6
)
BindingList Stream Writing Problem
DateTimeNow