Hello..
I have a datagridview.. It is unbound to any database and has 2 columns..
1 is item name and other is amount/expense, incurred..
I want the total of expense incurred be displayed in the textbox on button click ie adding the numbers in amount column..
I tried something like this, but not working.. Please help !!
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim iSselected As Boolean
Dim CurrentCellValue As String
Dim CumulativeSummer As Integer
Dim i As Integer
With Me.DataGridView1
For i = 0 To .RowCount - 1
iSselected = .Rows(i).Cells(0).Value
CurrentCellValue = .Rows(i).Cells(1).Value
If CurrentCellValue = "" Then CurrentCellValue = 0
If iSselected = True Then
CumulativeSummer += Convert.ToInt32(CurrentCellValue)
End If
Next
End With
Me.TextBox2.Text = CumulativeSummer