vb: how to use undo?
Website Design
Website Promotion
Graphic Design
Programming
Free Software
Computer Tips
Discount Stores
|
This site provides users with the information about vb, visual basic, vb6, how to undo, how to use undo, and more.
If you think that this site is helpful, please recommend your friends to visit our site.
There are two ways to use undo in visual basic. The following is how to:
The first method
'Windows API provides an undo function
'Do the following declares:
Declare Function SendMessage Lib "User" (ByVal hWnd As _
Integer, ByVal wMsg As Integer, ByVal wParam As _
Integer, lParam As Any) As Long
Global Const WM_USER = &h400
Global Const EM_UNDO = WM_USER + 23
'And in your Undo Sub do the following:
UndoResult = SendMessage(myControl.hWnd, EM_UNDO, 0, 0)
'UndoResult = -1 indicates an error.
The second method
'The procedure used for undo action
Private Sub Command1_Click()
Text1.SetFocus 'The textbox used to 'undo'
SendKeys "^Z" 'invoke Ctrl+Z
|