When you start a program, after performing some various management tasks the Windows PE loader calls your application entry point procedure. This is where your application begins.

By default, Visual Basic assigns a "startup object", usually Form1. This is a very bad design because it leaves you with no control over the startup process. The form is loaded whether you want or not, and your code begins effectively in Form_Load().

Instead of leaving it be, go into Project -> Properties and select "Sub Main" as your startup "object". Make a new standard (.bas) module and enter the following stub in
VB Code:
  1. Public Sub Main()
  2.  
  3. End Sub

Your code now begins in that procedure, before any forms or objects are instantiated. Also by using the runtime Command$() function you can retrieve the command-line arguments that are passed by the Windows loader.