In a Visual Basic 5 file (.vbd), how do I call userDocument terminate from userDocument Hide?
Option Explicit
Private Sub Command1_Click()
MsgBox "hello World"
End Sub
Private Sub UserDocument_Hide()
MsgBox "Before Termination"
<I want UserDocument termination here>
MsgBox "After Termination"
End Sub
While you can call the same code that occurs on termination, you can’t actually terminate the object.
Object termination occurs when all references to it are released, and implicitly all code running in it exits.
For what you want to do, you have to get whatever created/is using your UserDocument to release it.
You may be able to do this by putting an event in your object and calling it from the
Hideevent that that caller listens for and releases it.Obviously, if the caller is not your code, you can not do this.