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

VS 2010 How to sum values inserted in DataGrid cells

$
0
0
Hi,

I want to sum two values being inserted in two cells in a DataGridView.

And the result should be output in a specified cell.

I already wrote a code but my code doesn't work like it supposed to work.

What is wrong with the code?

Code:

    Private Sub dgdTax_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgdTax.CellContentClick

        '======================================== CALCULATION ==============================================='

        'to calculate r4rm1
        Dim r2rm1 As Integer
        Dim r3rm1 As Integer
        Dim r4rm1 As Integer

        r2rm1 = Convert.ToInt32(dgdTax(1, 2).Value.ToString())
        r3rm1 = Convert.ToInt32(dgdTax(1, 3).Value.ToString())
        r4rm1 = r2rm1 + r3rm1
        dgdTax(1, 4).Value = r4rm1
    End Sub


Viewing all articles
Browse latest Browse all 27554

Trending Articles



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