Click here to Skip to main content
15,885,032 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hello friends,

I have lot of editable controls(textboxes, datagrid views, comboboxes etc) on my winform. Currently if i select a particular control and press Ctrl+Z or +Y, it works only for that particular selected control. But our requirement is to use the Undo/redo functionality for all the controls.

For eg.: If user has modified 30 controls then when he does Undo/redo, the changes should get reflected for all controls one after another. Its like till u finished undo-ing/redo-ing the last modified control.

How to achieve this? Please suggest.
Thanks
Posted
Comments
Philippe Mori 29-Jun-15 12:55pm    
You have to implement your own system.

1 solution

You would have to remember the order in which controls have accepted user input. Be sure to have the form's KeyPreview property set so you can change focus whenever appropriate during a sequence of several Undos.

Or do it right, data-bind all the controls and work on the underlying data. There's an article on an Undo/Redo Buffer Framework here at CP. Don't be afraid of the broken link to the other article on Mementos. The search works quite well.

Good luck.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900