Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27193

VS 2010 Sum Data To the Left in Datagridview [Sum Rows In Datagridview]

$
0
0
What's Up Broo..
I need to sum data in datagridview's rows.. [Or sum data to the left side]

This is the ilustration :
++ I have dgv1

Name:  dgvSum1.JPG
Views: 111
Size:  39.2 KB

++ I have dgv2

Name:  dgvSum2.JPG
Views: 70
Size:  29.1 KB

I want sum data Column(2) and Column(3) and Column(4) in dgv1
In row 0 = 60 + 80 + 40 == 180
In row 1 = 60 + 80 + 60 == 200
In row 2 = 100 + 100 + 20 === 220
Next....

And i want Put the result in my dgv2 in Column(2)
In row 0 = 180
In row 1 = 200
In row 2 = 220
Next....

I have been try some code :

Code:

' This Is For Column(2) In row (0)

Dgv2.Item(1,dgv2.Currentrow.Index).Value = dgv1.Item(1,dgv1.Currentrow.Index).Value * dgv1.Item(2,dgv1.Currentrow.Index).Value

'The result is 180

But that is just for one rows..
Teach me how to do it using Loop (For - Next)..

Thanks!!
Attached Images
  

Viewing all articles
Browse latest Browse all 27193

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>