System.Windows.Forms.Button.DialogResult Property

Gets or sets a value that is returned to the parent form when the button is clicked.

Syntax

[System.ComponentModel.DefaultValue(System.Windows.Forms.DialogResult.None)]
public virtual DialogResult DialogResult { set; get; }

Value

Documentation for this section has not yet been entered.

Remarks

If the System.Windows.Forms.DialogResult for this property is set to anything other than None, and if the parent form was displayed through the Form.ShowDialog method, clicking the button closes the parent form without your having to hook up any events. The form's Form.DialogResult property is then set to the System.Windows.Forms.DialogResult of the button when the button is clicked.

For example, to create a "Yes/No/Cancel" dialog box, simply add three buttons and set their System.Windows.Forms.DialogResult properties to Yes, No, and Cancel.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0