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
Shovan Saha
NA
321
92.7k
How can I subtract?
Aug 4 2017 3:21 PM
I want the result of :
count220 - countTotal = ?
sum220 - sumTotal = ?
Here is my code:
var countTotal = Convert.ToInt32(count1 + count2 + count3 );
double sumTotal = Convert.ToDouble(sum1 + sum2 + sum3 );
var count220 = 0;
foreach (DataGridViewRow g1 in dataGridView1.Rows)
{
if (g1.Cells[2].Value.ToString() != "")
count220 = count220 + Convert.ToInt32(g1.Cells[5].Value);
}
double sum220 = 0;
foreach (DataGridViewRow g1 in dataGridView1.Rows)
{
if (g1.Cells[2].Value.ToString() != "")
sum220 = sum220 + Convert.ToDouble(g1.Cells[5].Value);
}
Reply
Answers (
2
)
Please check my code
How to do DataGrid Column sort from code behind?