你會想將「泡沫式」的事件被第三形式拋出每個窗體上添加事件處理程序。
Public Class Form1
Private WithEvents form2 As New Form2
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
form2.Show()
End Sub
Private Sub Form2_MyEvent() Handles form2.MyEvent
MessageBox.Show("We're back on Form1.")
End Sub
End Class
Public Class Form2
Private WithEvents form3 As New Form3
Public Event MyEvent()
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
form3.Show()
End Sub
Private Sub Form3_MyEvent() Handles form3.MyEvent
RaiseEvent MyEvent()
End Sub
End Class
Public Class Form3
Public Event MyEvent()
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
RaiseEvent MyEvent()
End Sub
End Class
表單是模態還是非模態?進度條是否繼續更新並且Form1在其他表單打開時接收消息?按下form3上的按鈕時會發生什麼,它會關閉form2和form3嗎? – ja72