|
-
Feb 16th, 2007, 04:37 PM
#1
Thread Starter
Lively Member
Datagrid delete multiple rows w/ complexity
In VB 2003 I have a form app with a datagrid. Right now they can change things in the datagrid and click the cancel changes button if they want to undo. I want to be able to delete multiple rows without accepting changes until they are done. This seems to be a problem because the datagrid.currentRowIndex is no longer aligned with the datatable after you delete a row. I know I can align them if I acceptChanges but that is not what I want. Any help would be greatly appreciated.
-
Feb 16th, 2007, 08:38 PM
#2
Re: Datagrid delete multiple rows w/ complexity
Forget the grid. Work with the data source. If a row gets deleted then remember it by assigning it to a variable. If you want to undo you call that row's RejectChanges method and presto, it's undeleted. You can be notified when a row gets deleted from a DataTable by handling its RowDeleted event.
-
Feb 20th, 2007, 10:42 AM
#3
Thread Starter
Lively Member
Re: Datagrid delete multiple rows w/ complexity
How would I delete the appropriate row though. For example if I delete the first row with the following code:
VB Code:
Me.objClientSummary.WP_ClientSummary.Rows(Me.grdWP_ClientSummary.CurrentRowIndex).Delete()
If I delete the next one after that it sends the same index value and that row is already in the table in a deleted.
If I can send a row object instead that would be great. But how?
Remember I am trying to keep these rows in a deleted state until the user decides they are finalized at which point the changes to the table will be applied.
-
Feb 20th, 2007, 10:48 AM
#4
Thread Starter
Lively Member
Re: Datagrid delete multiple rows w/ complexity
How would I delete the appropriate row though. For example if I delete the first row with the following code:
VB Code:
Me.objClientSummary.WP_ClientSummary.Rows(Me.grdWP_ClientSummary.CurrentRowIndex).Delete()
If I delete the next one after that it sends the same index value and that row is already in the table in a deleted.
If I can send a row object instead that would be great. But how?
Remember I am trying to keep these rows in a deleted state until the user decides they are finalized at which point the changes to the table will be applied.
-
Feb 20th, 2007, 04:03 PM
#5
Re: Datagrid delete multiple rows w/ complexity
Get the row from the table's DefaultView, not the table itself.
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
|