Discussion Locked

Visual Basic 6.0

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
require coding for creating a redo and undo option while creating a note pad on visual basic 6.0 as an desktop applicaton

5 replies

by mark.thomson

Havea look at the September 1999 Edition of "Visual Basic Programmer's Journal" - contained in the periodicals section of the MSDN CDs/DVD - which gives the basics on how to utilise the existing Undo facilities in Windows from within VB

by mohammad_m_saggaf

Simply you can use a form-scope array of a user-defined type contains an integer or long varible as a index and string varible to contain the last update.
how many Unro or Redo times that will be how many items in the array.
the user-defined could be somthing like that:

' For 100 times of undo
Dim StrText(100) As String * 2048 '2 KB string.
' To hold your position.
Dim IntUnDoPos As Integer

Private Sub Form_Load()
IntUnDoPos = 0
End Sub

Private Sub UnDo()
IntUnDoPos = IntUnDoPos - 1
Text1.Text = StrText(IntUnDoPos)
End Sub

Private Sub ReDo()
IntUnDoPos = IntUnDoPos + 1
StrText(IntUnDoPos) = Text1.Text
End Sub

Private Sub Text1_Change()
IntUnDoPos = IntUnDoPos + 1
StrText(IntUnDoPos) = Text1.Text
End Sub

I hope it helped :-)

This discussion is closed to new replies.