Search code examples
vb.netformshideonload-event

How can I "unhide" this form without triggering the _load event?


I'll just get straight to it, I have this code:

Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    startup.Show()
    Me.WindowState = FormWindowState.Minimized
    Me.ShowInTaskbar = False
    Me.Hide()
End Sub

This is going to be the form which loads first, having the entire project shutting down when this form closes (hence why I have to load this form first & calling the startup from this)

After the startup form has finished it's code, I have this code:

    ...
    frmMain.ShowInTaskbar = True
    frmMain.WindowState = FormWindowState.Normal
    Me.Close()

How can I get the main form to load again without actually triggering it's _load event (thus avoiding it to trigger an infinite loop).


Solution

  • did you mean show the main form?

    frmMain.Show()
    frmMain.BringToFront()