Home » C# Basics » 08 - Windows Programming - 1
8

Button Control

Defines the properties of the button control in a windows application

The Button control is a very common control that we can find in almost every windows application. When the user clicks on the button with mouse, some action occurs such as confirmation (OK, Cancel, Retry), saving some data or opening another form.

The important properties of the Button control are -

(Name)

The name used to access the control in code.

Enabled

To decide if the button is clickable or not.

FlatStyle

To change the style of the button.

Image

To specify an image to be displayed on the button.

Text

The caption of the button. To assign a shortcut key, the character to be made the shortcut (pressed with the ALT key) is preceded by the & symbol.

Visible

To decide if the button is visible or not.

The most important event of the Button control is the Click event. This event occurs when the user clicks the button. We can write the code for this event by double clicking on the button or double clicking in the cell next to click event in the properties window.