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 Object
Set objectname = New classname 

Private Sub Class_Initialize( )
 Initalization code goes here
End Sub
'When Object is Set to Nothing
Private Sub Class_Terminate( )
 Termination code goes here
End Sub

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 Object
Set objectname = New classname 

Private Sub Class_Initialize( )
 Initalization code goes here
End Sub
'When Object is Set to Nothing
Private Sub Class_Terminate( )
 Termination code goes here
End Sub



Discussion

No Comment Found