Wednesday, August 15, 2007

Console and Windows Form in the same application

I recently needed to write a program that had an attended and unattended mode:

1. Create a console application in Visual Studio .NET.

2. Use this as a template:

Module Module1

    Sub Main()
        If Command$() = "-winform" Then
            Dim frm As New testform()
            Windows.Forms.Application.Run(frm)
        Else
            Console.WriteLine("this is the console option")
        End If
    End Sub

End Module

1 comment: