I'm using the code below to sum a column in my datagrid, and it works. BUT when i delete a row and try rerunning the code i get the following error.
-Deleted row information cannot be accessed through the row.-
Code:Private Sub cmdShow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdShow.Click ShowBalance(DataSet11) End Sub Private Sub ShowBalance(ByVal dataset As DataSet) Try Dim dataTable As DataTable = dataset.Tables(0) Dim Rows As Integer = dataTable.Rows.Count Dim Row As Integer = 0 Dim number As Integer = 0 While Row < Rows number = Convert.ToInt32(dataTable.Rows(Row)(1)) txtTotalBalance.Text = number + Convert.ToInt32(txtTotalBalance.Text) Row += 1 End While Catch ShowBalanceException As System.Data.OleDb.OleDbException MessageBox.Show(ShowBalanceException.Message) End Try End Sub




Reply With Quote