Visual Basic helps.....

MC

Platinum Member
Feb 23, 2000
2,747
0
0
i never use VB before and now i need help from ATOT!

I need to implement an UNDO function for a VB program, how should i do it? Not just a text box, but all the commands, any help would be great, code would be awesome.
 

chsh1ca

Golden Member
Feb 17, 2003
1,179
0
0
Well, for starters, you need a buffer of the previous commands, and possibly the states of the data. You're going to have to decide how big the buffer should be. Considering the amount of work it would take, I'd genuinely be surprised if someone just gave you code to do it.
 

oog

Golden Member
Feb 14, 2002
1,721
0
0
There are a couple of approaches to this. One way is to create a list of all previous states of the data and be able to load up your application with any state of data. Every time data changes, you add another state. You would want to put a limit to the number of Undo states you store.

Another approach is to not track the entire state of the data with every change, but to essentially summarize what it would take to undo/redo any action. So you keep track of a list of action pairs. At any point, you can play these actions forward or backwards and they would modify the current state. You couldn't jump anywhere in the Undo stack you wanted, but most applications don't need this.

I was recently programming a game of Go, and I needed undo functionality. It needs to not only track the positions of all the stones on the board, but other key aspects of the game. I got lazy and just tracked every move that was made, and not an "undo" action. I also didn't track the full game state after every move. If the player wanted to undo a move, I just reset the whole game and played it forward from the beginning until I reached the point before the very last move. This may seem inefficient, but the game is simple enough that even very low end devices could play through 100 moves forward with almost no delay.
 

bsmithy

Senior member
Oct 24, 2003
458
0
0
best way programatically is to add an undo section to each procedure and then call the procedures in reverse order with the undo switch on.
but this will only go so far, you may have to store variable values aswell

eg

Sub dosomestuff(number1 as integer,number2 as integer, undo as boolean)

stuff goes here

End Sub
 
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |