|
-
May 21st, 2004, 12:23 PM
#1
Thread Starter
Hyperactive Member
Datagrid Recalculate
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
-
May 21st, 2004, 12:39 PM
#2
Hyperactive Member
After you have deleted your row, do you update the dataset?
The process of deleting a row in a datatable simply marks the row for deletion, it does not actually delete it until you run the update command.
-
May 21st, 2004, 01:46 PM
#3
Thread Starter
Hyperactive Member
how do you capute the event of a row being deleted?
-
May 31st, 2004, 11:40 AM
#4
Hyperactive Member
there is no ned to bother capturing the delete event, there is a row state property which means you can ignore any rows set for deletion.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|