MDI w/ child forms using activated event

G

Guest

I have a MDI form with the following
Public fm2 As New Form2()
Public fm3 As New Form3()
and
Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click
fm2.MdiParent = Me
fm2.Show()
End Sub

Private Sub MenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem3.Click
fm3.MdiParent = Me
fm3.Show()
End Sub

Both MDIChild have this
Private Sub Form2_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Activated
Me.Text = "Form Two"
End Sub

The first form I show will fire its activated event. the second form to sow will not fire the activated event
If I comment the mdichild = me from the show calls then both child forms will fire the activated event
Can anyone help me get the activated event to fire or both forms regardless of the order in which they are started
 
C

Cor Ligthert

Hi Slaprade,

I use the me.load event for that instead of the activated, gives me never
trouble.

Cor
I have a MDI form with the following
Public fm2 As New Form2()
Public fm3 As New Form3()
and
Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MenuItem2.Click
fm2.MdiParent = Me
fm2.Show()
End Sub

Private Sub MenuItem3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MenuItem3.Click
fm3.MdiParent = Me
fm3.Show()
End Sub

Both MDIChild have this
Private Sub Form2_Activated(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Activated
Me.Text = "Form Two"
End Sub

The first form I show will fire its activated event. the second form to
sow will not fire the activated event
If I comment the mdichild = me from the show calls then both child forms will fire the activated event
Can anyone help me get the activated event to fire or both forms
regardless of the order in which they are started
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top