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
Shyja Abraham
NA
69
0
sum of datagridview values
Feb 7 2011 4:01 PM
I have form with datagridview with columns id,name,mark .and a textbox total.Iwant to find the sum of the mark when we entered the values into the datagridview.
int sum=0;
private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
{
sum += Convert.ToInt32(dataGridView1.Rows[i].Cells["mark"].Value.ToString());
textBox1.Text = Convert.ToString(sum);
}
}
but the "Object reference not set to an instance of an object" error occurs, plz help;
Reply
Answers (
3
)
Storing SQL Select Results into Variable
Japanese text to speech conversion