DefaultButton Property

Property that allows you to get or set which push button is activated when the user presses the Enter key. The default value for this property is "OK."

object.DefaultButton = caption_of_button
existing_value
= object.DefaultButton

Arguments

object

Required.  A variable containing a dialog object created by calling CreateObject or new ActiveXControl.

caption_of_button

Required. Caption of the button that should be activated when the user presses the Enter key.

existing_value

A variable to receive the caption of the button that will be activated when the user presses the Enter key.

Remarks
If your dialog box does not include a button with the caption "OK," you should set the DefaultButton property to the caption of some other button on your dialog box. See also CancelButton.

Example

Sub main
  ' Create the dialog box
  Set Dialog = CreateObject("TPFSoftware.ScriptDialog")


 ' Add a row of buttons  Dialog.AddButtons "button", Array("Continue", "Quit")
 ' Ensure that pressing Enter will activate Continue  Dialog.DefaultButton = "Continue"
 ' Display the dialog box  Set Result = Dialog.Execute
 ' Determine whether the user pressed Enter or clicked Continue
  If Result.ValueOf("button") = "Continue"
    ' Take some action...
  End If
End Sub