J'ai besoin d'un moyen de savoir quand un formulaire a fini de charger. Mon raisonnement est que j'ai un deuxième formulaire qui est chargé lorsque ce formulaire se charge. Le code pour cela est appelé de form1.load
.VB.NET .NET après un événement de chargement?
Form2
est actuellement affiché derrière form1
que je devine form1
appelle un Activate ou similaire à la fin de la charge de sorte que toute Activer, BringToFront, etc. invite form2
sont surchargés.
Si vous regardez le code ci-dessous, je l'ai essayé d'ajouter frmAllocationSearch.Activate
, frmAllocationSearch.BringToFront
et Me.SendToBack
après l'appel à ShowAlloactionSearchDialog()
, mais ceux-ci sont tout perdu comme quelque chose qui se passe après l'événement de chargement est déclenché pour amener Me
à l'avant.
Le code est:
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
Je devais ajouter un drapeau pour l'empêcher d'être sur le dessus tout le temps mais c'était parfait. – themaninthesuitcase