How to have an invisible start up form?

Paste this in your form code:

Protected Overrides Sub SetVisibleCore(ByVal value As Boolean)
    If Not Me.IsHandleCreated Then
        Me.CreateHandle()
        value = False
    End If
    MyBase.SetVisibleCore(value)
End Sub

The way that works is that the very first request to show the form, done by the Application class, this code overrides the Visible property back to False. The form will behave as normal after this, you can call Show() to make it visible and Close() to close it, even when it was never visible. Note that the Load event doesn't fire until you show it so be sure to move any code in your event handler for it, if any, to the constructor or this override.


Put this in the form's Shown event

Me.Visible = False