NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Button Class

Represents a standard Windows button.

Object
   MarshalByRefObject
      MarshalByRefComponent
         Control
            RichControl
               ButtonBase
                  Button

[Visual Basic]
Public Class Button
   Inherits ButtonBase
   Implements IButtonControl
[C#]
public class Button : ButtonBase, IButtonControl
[C++]
public __gc class Button : public ButtonBase, IButtonControl
[JScript]
public class Button extends ButtonBase, IButtonControl

Remarks

Set the AcceptButton or CancelButton property of the form to allow users to choose a button by pressing the ENTER or ESC keys, or they may press the button using the mouse.

When you display a form using the ShowDialog method, you can use the DialogResult property of a button to specify the return value of ShowDialog.You may change the button's appearance, to make it appear flat for a web look, set the FlatStyle property to FlatStyle.Flat. The FlatStyle property can also be set to FlatStyle.Popup which appears flat until the mouse pointer is over the button, then the button takes on the standard Windows button appearance.

Requirements

Namespace: System.WinForms

Assembly: System.WinForms.dll

Example [Visual Basic]

The following example instantiates a Button and sets its DialogResult property to DialogResult.Ok.

[Visual Basic]

' Instantiate a Button.
Private Button1 As System.WinForms.Button
Private MySub()
   ' Initialize a new Button.
   Form1.Button1 = New System.WinForms.Button
 
  ' Set the button to return a value of Ok when clicked.
   Button1.DialogResult = DialogResult.Ok

   ' Add the button to the form.
   Form1.Controls.Add(Button1)
End Sub

See Also

Button Members | System.WinForms Namespace | ButtonBase | RadioButton | CheckBox | IButtonControl