开发者

how to call back to original form

I have 2 forms. Form开发者_JAVA技巧1 and Form2.

When Form2 is closing, how do I make Form2 to inform Form1 that Form2 is closed.

Do I need to use Delegate, if yes, how?

thanks.


You will need to first reference Form2 from Form1, then you can use one of the close events on the other form. Either the Form.OnClosed or Form.OnClosing events.

' On form1
Private Sub Form2_Closing(ByVal sender As Object, _
     ByVal e As EventArgs) Handles Form2.OnClosing

    ' Form2 informed us that it is closing. Do stuff!

End Sub


You can just create a custom event in Form2 and then make Form1 subscribe to it. Here's a nice and easy tutorial article for this:

http://www.codeproject.com/KB/vb/StepByStepEventsInVBNET.aspx

Edit: If you just need the event when it's closing, I'd go with Oded's solution since that's easier.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜