VB.Net - Button Control
Windows Forms controls are reusable components that encapsulate user interface functionality and are used in client side Windows applications. A Button is a control, which is an interactive component that enables users to communicate with an application which we click and release to perform some actions.
The Button control represents a standard button that reacts to a Click event. A Button can be clicked by using the mouse, ENTER key, or SPACEBAR if the button has focus.
When you want to change display text of the Button , you can change the Text property of the button.
Button1.Text = "My first Button" |
Similarly if you want to load an Image to a Button control , you can code like this.
Button1.Image = Image.FromFile("C:\testimage.jpg") |
The following vb.net source code shows how to change the button Text property while Form loading event and to display a message box when pressing a Button Control.
Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Button1.Text = "Click Here" End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click MsgBox("http://vbnet.com") End Sub End Class