Table of contents

TextBox.Undo 事件 (访问)TextBox.Undo Event (Access)

office 365 dev account|上次更新日期: 2018/3/13
2 参与人员

当用户撤消更改时发生。Occurs when the user undoes a change.


表达式撤消(* 取消,)expression. **Undo( ** Cancel*, )

表达式_一个表示文本框对象的变量。_expression A variable that represents a TextBox object.


名称Name必需/可选Required/Optional数据类型Data Type说明Description
CancelCancel必需RequiredIntegerInteger将此参数设置为True可以取消撤消操作,并将控件或窗体保留为其编辑后的状态。Set this argument to True to cancel the undo operation and leave the control or form in its edited state.


只要用户通过单击命令栏上的撤消字段/记录按钮、 单击撤消按钮、 按 esc,或调用Undo方法,将控件返回其原始状态,控件的 Undo 事件发生时指定的控件。需要所有这三种情况中具有焦点的控件。如果用户单击了命令栏上的撤消键入按钮不会发生事件。The Undo event for controls occurs whenever the user returns a control to its original state by clicking the Undo Field/Record button on the command bar, clicking the Undo button, pressing the ESC key, or calling the Undo method of the specified control. The control needs to have focus in all three cases. The event does not occur if the user clicks the Undo Typing button on the command bar.


下面的示例说明了捕获窗体的 Undo 事件的子例程的语法。The following example demonstrates the syntax for a subroutine that traps the Undo event for a form.

Private Sub Form_Undo(Cancel As Integer) 
 Dim intResponse As Integer 
 Dim strPrompt As String 

 strPrompt = "Cancel the undo operation?" 

 intResponse = MsgBox(strPrompt, vbYesNo) 

 If intResponse = vbYes Then 
 Cancel = True 
 Cancel = False 
 End If 
End Sub

另请参阅See also


TextBox 对象TextBox Object

© 2018 Microsoft