Private Sub MyApplication_Startup(ByVal sender As Object, _
ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) Handles Me.Startup
If loginform.ShowDialog <> DialogResult.OK Then e.Cancel = True
End Sub
You get to the Application Events from main menu Project Properties, Application tab, click "View Application Events" button.
Me.Hide()
Dim FrmMain As New FrmMain
FrmMain.Show()
DialogResult = Windows.Forms.DialogResult.OK