Writing a Hello World Form

Getting started with Windows Forms is very simple. The following example displays a top level window (called a form) and sets the caption bar text to "Hello World".



Imports System
Imports System.ComponentModel
Imports System.Drawing
Imports System.Windows.Forms

Namespace Microsoft.Samples.WinForms.VB.SimpleHelloWorld

    Public Class SimpleHelloWorld
        Inherits System.Windows.Forms.Form

        'Run the application
        <STAThread()> Shared Sub Main()
            System.Windows.Forms.Application.Run(New SimpleHelloWorld())
        End Sub

        Public Sub New()
            MyBase.New()
            Me.Text = "Hello World"
        End Sub
    End Class

End Namespace
VB

To view and run this sample:

 
VB Simple Hello World

[Run Sample] | [View Source]


Copyright 2001 Microsoft Corporation. All rights reserved.