Public Class Form1
Dim pro As Process
Public Event Exited As EventHandler
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
pro = New Process
pro.StartInfo = New ProcessStartInfo("notepad")
pro.Start()
pro.EnableRaisingEvents = True
AddHandler pro.Exited, AddressOf process_Exited
End Sub
End Class
Module something
Public Sub process_Exited(ByVal sender As Object, ByVal e As System.EventArgs)
Form1.Text = "ok"
MsgBox("Was called")
End Sub
End Module
Form1的文本没有改变,即使我可以告诉自从消息框显示以来调用了该函数。
我在Form1.Text =“ok”之后尝试过Form1.Refresh(),但它仍然是“Form1”。
为什么会这样,我该如何解决?