Groups | Blog | Home
all groups > vb.net controls > april 2004 >

vb.net controls : Terminate Event for User Control?


Tom
4/27/2004 2:55:38 PM
Let's say I have a user control that I wrote in VB.NET. When it is loaded I
open a file; now, when the user control terminates, I need to close that
file.

In VB6 this was easy because it had a UserControl_Terminate event; however,
there is no such event for .NET. How is this handled, especially with .NET's
garbage collection? True, I could code some CloseFile routine that I could
call prior to leaving the form that has the control on it, but it seems
there should be a more 'automatic' way.....

Tom

Ken Tucker [MVP]
4/27/2004 5:35:13 PM
Hi,

Take a look at the Finalize event

Ken
---------------
[quoted text, click to view]

AddThis Social Bookmark Button