I need a way to find out when the form has finished loading. My reasoning: I have a second form that loads when this form loads. The code for this is called from form1.load .
Form2 is currently displayed behind form1 , since I assume that form1 triggers an activation or similar at the end of the load, so any Activate, BringToFront, etc. Form2 calls are redefined.
If you look at the code below, I tried to add frmAllocationSearch.Activate , frmAllocationSearch.BringToFront and Me.SendToBack after calling ShowAlloactionSearchDialog() , but they were all wasted, because something happens after the load event is fired transfer Me to Start.
The code:
Private Sub Allocation_Load(ByVal sender As Object, ByVal e As System.EventArgs) _ Handles Me.Load ShowAlloactionSearchDialog() End Sub Private Sub ShowAlloactionSearchDialog() If frmAllocationSearch Is Nothing OrElse frmAllocationSearch.IsDisposed Then frmAllocationSearch = New AllocationSearch frmAllocationSearch.MdiParent = Me.MdiParent frmAllocationSearch.Info = Me.Info frmAllocationSearch.Top = Me.Top frmAllocationSearch.Left = Me.Left + Me.Width - frmAllocationSearch.Width frmAllocationSearch.AllocationWindow = Me frmAllocationSearch.Show() Else If frmAllocationSearch.WindowState = FormWindowState.Minimized Then frmAllocationSearch.WindowState = FormWindowState.Normal End IF frmAllocationSearch.Activate() End If End Sub
source share