1.

What are class events?

Answer»

There are two events that are automatically associated with every class by default. Class_Initialize and Class_Terminate.

Class_Initialize is triggered whenever you instantiate an object based on the class. Class_Terminate event is fired when the object goes out of scope or when the object is set to Nothing.

Example −

In the below example, we will make you understand how the events work in VBScript.

'Instantation of the ObjectSet objectname = New classname    Private Sub Class_Initialize(  ) Initalization code goes hereEnd Sub'When Object is Set to NothingPrivate Sub Class_Terminate(  ) Termination code goes hereEnd Sub


Discussion

No Comment Found