Before I even opened the project, I had a hunch about what was
wrong, because its a common problem that I myself have made.
Since a Windows application needs to have a continuous
message pump, and a window to handle it, you cannot use a
simple Form.Show() to show a new instance of a form when your
application starts from Sub Main. Instead,
you need to tell the application to send Windows messages to
a specific form. To do this, use the Application.Run() method.
After the form closes (and is destroyed and its message pump
destroyed), the code will return to the Sub Main and continue on
the next line of code.
This is what you currently have:
Code:
Public Sub Main()
myForm1.Show()
myForm1.TextBox1.Focus()
End Sub
This is what you need:
Code:
Public Sub Main()
Application.Start(myForm1)
Put the code to focus TextBox1 in the Forms load event
End Sub
The rest of the code in the module will work fine.
I should point out that it is better OOP practice to shun the use
of modules and instead use shared (aka static) method of classes.
You may want to try this in the future.