F
fred
Hi, without modifying the code in "Form2" to specifically raises an event,
is there a way of determining when either of the two instances of "Form2"
below, called MDIWindow1 and MDIWindow2, closes?
Reasons: I have an MDI app with multiple windows opened. I want to disable a
"Print" button in the toolbar the second the last MDI window is closed (so
need to catch an event when the MDI window is closed, see if it is the last
one, and if so disable the "Print" button).
Thank you
Frederic Marè
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
'blah
#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) _
Handles Button1.Click
Dim MDIWindow1 As New Form2
Dim MDIWindow2 As New Form2
MDIWindow1.MdiParent = Me
MDIWindow2.MdiParent = Me
MDIWindow1.Show()
MDIWindow2.Show()
End Sub
End Class
is there a way of determining when either of the two instances of "Form2"
below, called MDIWindow1 and MDIWindow2, closes?
Reasons: I have an MDI app with multiple windows opened. I want to disable a
"Print" button in the toolbar the second the last MDI window is closed (so
need to catch an event when the MDI window is closed, see if it is the last
one, and if so disable the "Print" button).
Thank you
Frederic Marè
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
'blah
#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) _
Handles Button1.Click
Dim MDIWindow1 As New Form2
Dim MDIWindow2 As New Form2
MDIWindow1.MdiParent = Me
MDIWindow2.MdiParent = Me
MDIWindow1.Show()
MDIWindow2.Show()
End Sub
End Class