| How to undo a textbox |
Applies To |
|
| OS: VB: |
NT, 9x, 2000 4, 5, 6 |
|
Code below provides the following functionality:
| Project Instructions |
|---|
| Add the following to a Form |
|---|
Private Declare Function SendMessage Lib "user32" _
Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, lParam As Any) As Long
Private Const EM_CANUNDO = &HC6
Private Const EM_EMPTYUNDOBUFFER = &HCD
Private Const EM_UNDO = &HC7
Private Sub Command1_Click()
SendMessage Text1.hwnd, EM_UNDO, 0&, 0&
End Sub
Private Sub Command2_Click()
SendMessage Text1.hwnd, EM_EMPTYUNDOBUFFER, 0&, 0&
End Sub
Private Sub Command3_Click()
Dim retcode As Long
retcode = SendMessage(Text1.hwnd, EM_CANUNDO, 0&, 0&)
If retcode Then
MsgBox "The text box can be UNDOne"
Else
MsgBox "The text box cannot be UNDOne"
End If
End Sub
| Remarks |
|---|