Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Stephens' Visual Basic Programming 24-Hour Trainer
This is the forum to discuss the Wrox book Stephens' Visual Basic Programming 24-Hour Trainer by Rod Stephens; ISBN: 978-0-470-94335-9
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Stephens' Visual Basic Programming 24-Hour Trainer section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old May 20th, 2014, 02:25 PM
Authorized User
Points: 82, Level: 1
Points: 82, Level: 1 Points: 82, Level: 1 Points: 82, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2014
Posts: 19
Thanks: 4
Thanked 0 Times in 0 Posts
Default Undo Redo operations in entity framework

Hi, I spent couple of hours searching for a solution and couldn't find a good one. I am looking for a way to add undo/redo functionalities to the datagrid views in my vb.net application. I use ADO EF to bind data to the DGV's.

Thanks for your help.
  #2 (permalink)  
Old May 20th, 2014, 03:13 PM
Rod Stephens's Avatar
Wrox Author
Points: 3,166, Level: 23
Points: 3,166, Level: 23 Points: 3,166, Level: 23 Points: 3,166, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2006
Location: , , .
Posts: 647
Thanks: 2
Thanked 96 Times in 95 Posts
Default

Hmm... that may be a bit tricky.

In general to add undo/redo functionality you create a stack of undo actions. To undo, you move the most recent action off of that stack and add it to a redo stack. To redo, you do the opposite.

That gets a lot more complicated if you use more powerful controls such as DataGridView. Those controls tend to have their own ideas about what undo and redo mean. For example, in a normal TextBox undo cycles between the last twp things you typed. (Or to think of it another way, the last thing you typed and whatever was there before you typed that.)

The DataGridView does provide some support via the underlying DataSet and DataTable objects. Take a look at these posts and see if they help.

I'm not sure how easy they are to use with EF. You might need to look more closely at the classes and modify their property procedures to create the necessary objects in the undo/redo stacks.

I think most applications just ignore this issue and only let the user cancel or commit changes. They don't provide a more fine-grained undo/redo.

I hope that helps.
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)
The Following User Says Thank You to Rod Stephens For This Useful Post:
shabnamzangeneh (May 20th, 2014)
  #3 (permalink)  
Old May 20th, 2014, 03:20 PM
Authorized User
Points: 82, Level: 1
Points: 82, Level: 1 Points: 82, Level: 1 Points: 82, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2014
Posts: 19
Thanks: 4
Thanked 0 Times in 0 Posts
Default

Thanks for your reply. I had seen those and couldn't understand how to apply those to DGV and/or EF. Thanks for the tip though. I may just provide accept/reject options to my users.
  #4 (permalink)  
Old May 20th, 2014, 03:37 PM
Rod Stephens's Avatar
Wrox Author
Points: 3,166, Level: 23
Points: 3,166, Level: 23 Points: 3,166, Level: 23 Points: 3,166, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2006
Location: , , .
Posts: 647
Thanks: 2
Thanked 96 Times in 95 Posts
Default

Quote:
I may just provide accept/reject options to my users.
For many applications, that's good enough. And it's way less work.
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)


Similar Threads
Thread Thread Starter Forum Replies Last Post
using entity framework 5 misuk11 BOOK: Professional ASP.NET Design Patterns 1 February 25th, 2014 05:23 PM
Entity Framework baxterwlane@hotmail.com BOOK: Professional Sitecore Development 0 January 3rd, 2014 12:40 PM
Entity Framework issue weixing BOOK: Beginning ASP.NET 4.5 : in C# and VB 1 April 26th, 2013 01:37 PM
Entity Framework vbboyd BOOK: Beginning ASP.NET 4.5 : in C# and VB 5 January 18th, 2013 11:48 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.