|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Undo a delete in a datagridviewUsing a DatagridView in .net 2.0
How would you go about implementing an "undo" event? So if the user selects a row in the datagridview, then hits the delete key, I handle the deletion by using the "datagridviews.rows.removeat" function. This removes the row from the datagridview, but the row should still be available because I have not yet committed the change to the database. Is there a simple property or method I can use to make the row visible again? thanks
Show quote
Hide quote
"Ausclad" wrote: I don't know if this is the correct way to do it...but I managed to get what > Using a DatagridView in .net 2.0 > > How would you go about implementing an "undo" event? > > So if the user selects a row in the datagridview, then hits the delete key, > I handle the deletion by using the "datagridviews.rows.removeat" function. > > This removes the row from the datagridview, but the row should still be > available because I have not yet committed the change to the database. > > Is there a simple property or method I can use to make the row visible again? > > thanks I wanted by doing the following.. For the datasource (in my case a datatable), I called the "RejectChanges" method and then with the bindingsource, i called "resetbindings" this reset the status of the deleted row, then reset the datagridview so that the value was now showing again. Ausclad schrieb:
> Hi Ausclad,> How would you go about implementing an "undo" event? > Don't know if it's what your looking for (Or if it's the best way...): Store the complete row(s) you want to delete within a private DataGridViewRowCollection before deleting them. When you click on your 'Undo' - Button or whatever, you can raise your event which should then pump the deleted values into the grid. Does that help?
Need a tip: How do you streamwrite from two different db tables?
Recognizing if SQL Server is installed (and what version) Q: Advice on threads How to simulate Application.DoEvents in a DLL open source .NET search engine? Bootstrapping .NET 2.0 Dispose problem/crash with maximized MDI child windows VB2005 - Split Files Visual Basic Programming - Reference to fpPublishLogInTempDir uri - ADVANCED question "Start external program" no longer works in VS2003 once 2.0 framework installed |
|||||||||||||||||||||||