Description
One of the advantages of VBScript engine version 5.1 is the support for classes. This means that you can now use classes to create objects in scripts. The create object function creates and returns a reference to an object. The following system script has been added as an example of how to create an object in a script:
Script I0047: Object Definition of Simple Script Lookup Form
rem Description : Simple Lookup Class
Class TSimpleLookup
public Version
public Title
public ResultField
public LocateValue
public Cancelled
private quLookup
Public Property Let SQL( aSqlStatement )
quLookup.SQL = aSqlStatement
End Property
Public Property Get ResultValue
ResultValue = quLookup( ResultField ).Value
End Property
rem Setup Initialize event
Private Sub Class_Initialize
set quLookup = Application.DataBase.CreateQuery( "" )		Cancelled = false
Version = "1.0.0"
End Sub
rem Setup Terminate event
Private Sub Class_Terminate
Set quLookup = nothing
End Sub
rem ....................................................................
public function Lookup
quLookup.Open
quLookup.Locate ResultField, LocateValue , 3
Lookup = quLookup.Lookup( Title , ResultField )
end function
end Class
Note: Please refer to the example in the Lookup Function for more information about how to use a class.