![]() | Type | Description | ||
| Key as Variant | A string expression that indicates the key of the button clicked. |
The ButtonClick event notifies your application that the user clicks a button. The AddButton method adds a new button to the editor. Also, the ButtonClick event is fired when user clicks the drop down button of an editor of one of the following types: DropDown, DropDownList, CheckList, Date, Color, Font, Picture, PickEdit and Button . In this case, the Key parameter is an empty string.
The following sample displays the key of the button that user clicked:
Private Sub Editor1_ButtonClick(ByVal Key As Variant)
Debug.Print "The user clicks the " & IIf(Key = "", "drop down", "'" & Key & "'") & " button"
End Sub
Private Sub Form_Load()
With Editor1
.EditType = DropDownList
.AddItem 1, "One"
.AddItem 2, "Two"
.AddButton "KeyA", 1
.Value = 1
End With
End Sub