Simple Button action : Button « GUI « VB.Net






Simple Button action

Simple Button action
Imports System
Imports System.Windows.Forms

Class MyFirstForm
    Inherits Form

    Private WithEvents mybutton As Button

    Public Sub New()
        Me.Text = "Hello, WinForms!"
        mybutton = New Button()
        mybutton.Text = "Click Me!"
        Me.Controls.Add(mybutton)
    End Sub

    Public Sub mybutton_Click(sender As Object, e As EventArgs) Handles mybutton.Click
        MessageBox.Show("Message")
    End Sub

    Shared Sub Main()
        Dim myform As Form = New MyFirstForm()
        Application.Run(myform)
    End Sub
End Class
           
       








Related examples in the same category

1.Sub class Button class to create a Clock buttonSub class Button class to create a Clock button
2.Change Button Font at RuntimeChange Button Font at Runtime
3.Simple Button Click actionSimple Button Click action
4.Set button backgroundSet button background
5.Add a Button to Frame DynamicallyAdd a Button to Frame Dynamically
6.Button Paint Event Button Paint Event