Link to home
Start Free TrialLog in
Avatar of Sereou
Sereou

asked on

Create an Undo button

My question is simple, though I imagine the answer may end up being beyond my skill.  I have a form, which has multiple check-boxes, buttons, etc.  I want to add an 'Undo' button that will step back (even if it's only one step back, and can't go back multiple steps) whenever clicked.

I have been all around search engines trying to get even a starting point, and to my surprise, I have found very little that was any help at all to me.

If anyone can help me, it would be much appreciated, as this project's deadline is 10/10, which is in less than 2 days, lol.  If all you have is code that I can use, that is fine, but I would very much like to understand how it works so I can work with it more in the future, so an explanation, or link to a tutorial would be wonderful.
ASKER CERTIFIED SOLUTION
Avatar of sunnycoder
sunnycoder
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Well ... you need some structure storing the previous state of your form.

The state you need to save -- is it all checkbox values?  Text box values?

Are the elements tied to a database?

How granular does the Undo need to be?  A separate state for every character entered or check changed?  Or just a separate state for each time the thing is submitted to the DB?

Somehow you'll need to look at a trail of changes made.  And the above questions will help determine the data structure  to use for it.
Avatar of Sereou
Sereou

ASKER

The state I need to save consists of text box values, with a few check boxes that can be ignored if need be.

Yes, the elements are tied to a database, an Access DB to be specific.

I don't need it to be every character entered, it can be a separate state for each thing submitted to the DB (not neccesarily updated via a query or what have you, but maybe if a field is deleted, or typed over?)

I'm taking a look at those links too, though I only know VB, hehe, and most of those seem to be C# or C++, so I'm slowly translating as I go =)
Since you are familiar with VB.NET, consider the VB.NET version of Rocky Lhotka's book:

http://books.google.co.in/books?id=AS7zAQaKt-oC&printsec=frontcover&dq=Experrt+VB.NET+2005+Business+Objects&sig=ACfU3U0SQCLKTC2VrJX5z3QssBKyroVmJg

This is precisely the same book, but written for VB.NET, as suggeted by sunnycoder's last link, above.  The examples are precisely the same, the only difference is that the code is written in VB.NET rather than C#.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Sereou

ASKER

The information in the book looks good, I'll look over it and see if I can find a solution.  I'm not sure I have time to study the information before my deadline though.  It's looking like 'Undo' functionality will not be implemented in my project.  Thank you guys for your help, I'll respond back again as soon as I look over the book and see if I can pull it off in one day, lol.
Glad to be of assistance.

AW