This is my first post on this site, so I don't know the rules. Please correct me if this gets to the wrong folks...etc.
PROBLEM: Many of the apps that I am writing need to be able to run 2 ways: They might be invoked from the command-line with parameters so that they do not show UI, but accomplish some task; OR they might be double-clicked, in which case they show a UI (so that the User can configure settings for the app...etc.).
To this end, I create the application as a Forms Application, but have a module that contains a
Public Sub Main(ByVal args() As String)
...procedure as the 'Startup object'.
If the app is double-clicked, there are no 'args', so I just ShowDialog() on the Main Form.
If the app is run from the command-line with args, then I don't ShowDialog() on the MainForm, and just do the work.
OK so far.
QUESTION: In the case where the User runs the application from the command line, I would like to write output to the DOS window (for ex: if they enter the incorrect args, then I want to display correct usage). But Console.Writeline() doesn't put output to the DOS window that the app is being run in?
How can I acheive this?
Am I wrong in doing things the way I am doing them with regards to my strategy of using a Forms Application but starting it with a Sub Main? Should I have created a Console application that somehow displays Forms?
Any help greatly appreciated!