// 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) using System; using System.Runtime.InteropServices; using System.Windows.Forms; namespace E { public class MyForm : Form { public MyForm() { Text = "This is my form"; } } public class Program { [DllImport("kernel32.dll")] public static extern bool FreeConsole(); public static void Main(string[] args) { Console.Write("Press enter to switch to GUI mode"); Console.ReadKey(); FreeConsole(); Form f = new MyForm(); f.ShowDialog(); } } }