Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 2010 > BOOK: Stephens' Visual Basic Programming 24-Hour Trainer
Password Reminder
Register
Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old May 20th, 2014, 03: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.
Reply With Quote
  #2 (permalink)  
Old May 20th, 2014, 04:13 PM
Rod Stephens's Avatar
Wrox Author
Points: 3,145, Level: 23
Points: 3,145, Level: 23 Points: 3,145, Level: 23 Points: 3,145, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2006
Location: , , .
Posts: 641
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!)
Reply With Quote
The Following User Says Thank You to Rod Stephens For This Useful Post:
shabnamzangeneh (May 20th, 2014)
  #3 (permalink)  
Old May 20th, 2014, 04: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.
Reply With Quote
  #4 (permalink)  
Old May 20th, 2014, 04:37 PM
Rod Stephens's Avatar
Wrox Author
Points: 3,145, Level: 23
Points: 3,145, Level: 23 Points: 3,145, Level: 23 Points: 3,145, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2006
Location: , , .
Posts: 641
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!)
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 02:37 PM
Entity Framework vbboyd BOOK: Beginning ASP.NET 4.5 : in C# and VB 5 January 18th, 2013 11:48 AM



All times are GMT -4. The time now is 03:45 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.