Set Instruction

Syntax

Set objvar = objexpr
-or-
Set objvar = New objtype

Group

Assignment

Description

Form 1: Set objvar's object reference to the object reference of objexpr.

Form 2: Set objvar's object reference to the a new instance of objtype.

The Set instruction is how object references are assigned.

Example


Sub Main
    Dim App As Object
    Set App = CreateObject("WinWrap.CppDemoApplication")
    App.Move 20,30 ' move icon to 20,30
    Set App = Nothing
    App.Quit       ' run-time error (no object)
End Sub