Initializes a new instance of the Button class.
[Visual Basic] Public Sub New() [C#] public Button(); [C++] public: Button(); [JScript] public function Button();
By default the Button displays no caption. To specify the caption text, set the Text property.
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
Button Class | Button Members | System.WinForms Namespace | Button