Private Sub RecalculateGrandTotal (...) handles myGrid.TextCellChange
If (mSkiptRecalculate) Then
exit sub
end if
Use the Class-private variable mSkipRecalculate to avoid
permanent recalculation when the grid is filled
Dim aRow as Datagridrow
Dim cellValue as integer
Dim runningTotal as interger = 0
For each aRow in myGrid.Rows
If aRow.Item("this").Text is nothing then
cellvalue = 0
else
cellValue = CInt(aRow.Item("this").Text)
end if
runningTotal += cellValue
Next row
lblGrandTotal.Text = CStr(runningTotal)
End Sub