Aleksandra
Registered User.
- Local time
- Today, 04:30
- Joined
- Jul 15, 2006
- Messages
- 12
Hello.
I'm trying to implement the ability to undo / redo in memo text box.
This is the code:
Unfortunately, I do not know how to make the cursor followed undo / redo.
I need your help.
Thanks in advance.
I'm trying to implement the ability to undo / redo in memo text box.
This is the code:
Code:
Private Sub Form_Load()
Me.Text0.SetFocus
Me.Text0.SelStart = 0
ReDim arrText(0)
arrText(0) = Me.Text0
Pointer = 0
End Sub
Private Sub Text0_Change()
If Undoing Then Exit Sub
Pointer = Pointer + 1
If Pointer > UBound(arrText) Then
ReDim Preserve arrText(Pointer)
End If
arrText(Pointer) = Me.Text0.Text
End Sub
Private Sub Undo_Click()
If Pointer = 0 Then
Beep
Else
Pointer = Pointer - 1
Undoing = True
Me.Text0 = arrText(Pointer)
Undoing = False
End If
End Sub
Private Sub Redo_Click()
If Pointer = UBound(arrText) Then
Beep
Else
Pointer = Pointer + 1
Undoing = True
Me.Text0 = arrText(Pointer)
Undoing = False
End If
End Sub
Unfortunately, I do not know how to make the cursor followed undo / redo.
I need your help.
Thanks in advance.
Last edited: