' Collection of code snippets by Arne Vajhøj 
' (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
Imports System
Imports System.Runtime.InteropServices
Imports System.Windows.Forms

Namespace E
    Public Class MyForm
        Inherits Form
        Public Sub New()
            Text = "This is my form"
        End Sub
    End Class
    Public Class Program
        <DllImport("kernel32.dll")> _
        Public Shared Function FreeConsole() As Boolean
        End Function
        Public Shared Sub Main(args As String())
            Console.Write("Press enter to switch to GUI mode")
            Console.ReadKey()
            FreeConsole()
            Dim f As Form = New MyForm()
            f.ShowDialog()
        End Sub
    End Class
End Namespace
