Your first Form window : Introduction « GUI « VB.Net Tutorial






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

End Class

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








14.1.Introduction
14.1.1.Your first Form window
14.1.2.Create Form by inheriting System.Windows.Forms.FormCreate Form by inheriting System.Windows.Forms.Form
14.1.3.Add button to a formAdd button to a form
14.1.4.Control Dock: Top, BottomControl Dock: Top, Bottom
14.1.5.Button PerformClick MethodButton PerformClick Method
14.1.6.Use With statement to set Form propertiesUse With statement to set Form properties
14.1.7.Essential elements of a Windows Forms application.
14.1.8.Using Controls in a Windows Forms Application