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?


Use command line arguments.

Make your program recognize certain command line switches:

  • myprog.exe /startup
  • myprog.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 ()

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.