Tech
Forums
Jobs
Books
Events
Videos
Conference
Annual Conference
Bcrypt
Ai Conference
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
2
Reply
How to get average of column of grid in case of null entry?
Ask a question
Ask a question
Upload Source Code:
Select only zip and rar file.
Muhammad Shah
8 years ago
341
1
Reply
I want to get the sum and also the average of GridView column .If there is any "null" entries in the column then it is not give me the sum.
int i = 0;
int j = 0;
int sum = 0;
try
{
for (i = 0; i < dataGridView1.Rows.Count - 1; i++)
{
for (j = 0; j < dataGridView1.Columns.Count; j++)
{
sum = sum + (Convert.ToInt32(dataGridView1.Rows[i].Cells[j].Value));
}
}
MessageBox.Show("sum"+sum);
}
I want to get average of the column and then place it in the null value cell.
any body help me
Post
Reset
Cancel
Answers (
2
)
Next Recommended Forum
cross threading seting form controls
store procedure