Start a Windows Application with a Main Subroutine
Problem
You want to start a Windows application without a startup form.
Solution
Create a module with a public Main method. Show all forms modally, or use the Application.Run method.
Discussion
There are several reasons that you might want to start a Windows application without using a startup form, including:
You want to show several forms at once.
You need to process command-line parameters (as described in recipe Retrieve Command-Line Parameters).
You need to programmatically decide which form to show initially.
You want to run your program in the background and provide a system tray icon that allows the user to access the full interface.
In these cases, you can start your application using a startup ...
Get Microsoft® Visual Basic® .NET Programmer's Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.