VB.net Net after load event?
Posted
by themaninthesuitcase
on Stack Overflow
See other posts from Stack Overflow
or by themaninthesuitcase
Published on 2010-03-12T09:54:52Z
Indexed on
2010/03/12
9:57 UTC
Read the original article
Hit count: 383
I need some way of knowing when a form has finished loading. My reasoning is I have a 2nd form that is loaded when this form loads. The code for this is called from form1.load.
Form2 is currently being displayed behind form1 as I am guessing form1 calls an activate or similar at the end of the load so any Activate, BringToFront etc calls on from2 are over ridden.
If you look at the code below I have tried adding frmAllocationSearch.Activate
, frmAllocationSearch.BringToFront
and Me.SendToBack
after the call to ShowAlloactionSearchDialog()
but these are all wasted as something is happening after the load event is fired to bring Me
to the front.
Code is:
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
frmAllocationSearch.Activate()
End If
End Sub
© Stack Overflow or respective owner