I've built a VB.NET program that contains multiple Forms. Now I want to display a particular Form (not the main/startup form) of the program through the Command Prompt.
For example, if there are two Forms in my program called startup_form and msg_form, I must run codes in CMD such that the program is executed but only msg_form is displayed and startup_form is hidden or not loaded at all.
How do I achieve that?
Answer
Use command line arguments.
Make your program recognize certain command line switches:
myprog.exe /startupmyprog.exe /msg
Within your code make it open and display the forms based on what switches are sent via the command line.
Environment.GetCommandLineArgs Method ()
No comments:
Post a Comment