10 April 2014

VB.NET: Button Control Sample Project

Design UI:


Code:
Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, _
                ByVal e As System.EventArgs) Handles MyBase.Load
        Button1.Text = "Do Event"
        Button2.Text = "Back Color = Red"
        Button3.Text = "Fore Color = Blue"
        Button4.Text = "Reset"
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, _
                ByVal e As System.EventArgs) Handles Button2.Click
        Button1.BackColor = Color.Red
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, _
                ByVal e As System.EventArgs) Handles Button3.Click
        Button1.ForeColor = Color.Blue
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, _
                ByVal e As System.EventArgs) Handles Button4.Click
        Button1.Text = "Do Event"
        Button1.BackColor = SystemColors.Control
        Button1.ForeColor = SystemColors.ControlText
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, _
                ByVal e As System.EventArgs) Handles Button1.Click
        Button1.Text = "Clicked"
    End Sub

End Class 
 
 Runtime:


Click here if you like this article.


Download Source: VS0005, VS2008

0 comments: