VB.Net - Button Control
The Button control represents a standard Windows button. It is generally used to generate a Click event by providing a handler for the Click event.Properties of the Button Control
The following are some of the commonly used properties of the Button control:S.N | Property | Description |
---|---|---|
1 | AutoSizeMode | Gets or sets the mode by which the Button automatically resizes itself. |
2 | BackColor | Gets or sets the background color of the control. |
3 | BackgroundImage | Gets or sets the background image displayed in the control. |
4 | DialogResult | Gets or sets a value that is returned to the parent form when the button is clicked. This is used while creating dialog boxes. |
5 | ForeColor | Gets or sets the foreground color of the control. |
6 | Image | Gets or sets the image that is displayed on a button control. |
7 | Location | Gets or sets the coordinates of the upper-left corner of the control relative to the upper-left corner of its container. |
8 | TabIndex | Gets or sets the tab order of the control within its container. |
9 | Text | Gets or sets the text associated with this control. |
Events of the Button Control
The following are some of the commonly used events of the Button control:S.N | Event | Description |
---|---|---|
1 | Click | Occurs when the control is clicked. |
2 | DoubleClick | Occurs when the user double-clicks the Button control. |
3 | GotFocus | Occurs when the control receives focus. |
4 | TabIndexChanged | Occurs when the TabIndex property value changes. |
5 | TextChanged | Occurs when the Text property value changes. |
6 | Validated | Occurs when the control is finished validating. |
EXAMPLE We will learn how to change the forecolor and back color using buttons and Move a label or text using buttons in up, down left and right directions.
a. First of all create a label and name its text as "See the change here" and rename it to lbltxt( or any other you may feel easy)
b.Make 2buttons for changing back and fore color and name them respectively btnFore and btnBack.
c. Make four buttons for for moving up,down,left and right (btnUp, btnDown, btnRight, btnLeft)
Download the code here........
password during extraction: soodeap
No comments:
Post a Comment