Name
Set Statement
Syntax 1
Setobjectvar= {[objectexpression | newclassname1Nothing}
-
objectvar Use: Required
Data Subtype: Object
The name of the object variable or property.
-
objectexpression Use: Optional
Data Subtype: Object
An expression evaluating to an object.
-
new Use: Optional
Type: Keyword
Creates a new instance of an object defined using the
Class...End Classconstruct.-
classname Use: Required
Data Subtype: String literal
The name of the class defined by the
Class...End Classconstruct to be instantiated.-
Nothing Use: Optional
Type: Keyword
Assigns the special datatype
Nothingtoobjectvar, thereby releasing the reference to the object.
Syntax 2
Setobject.eventname= GetRef(procname)
-
object.eventname Use: Required
Type: Event
The name of an object event that, when fired, causes the code in
procnameto execute.-
procname Use: Required
Type: String literal
The name of the procedure that serves as the event handler for
object.eventname.
Description
Assigns an object reference to a variable or property. Its second
syntax, using the GetRef function defines an
event handler for an event; this is discussed in the
GetRef function entry.
Rules at a Glance
objectvardoesn’t hold a copy of the underlying object; it simply holds a reference to (that is, the address of) the object.If the
Newkeyword is used, a new instance of the class is immediately created and its Class Initialize event fires. This applies only to classes defined using theClass...End Classconstruct.All classes defined by the
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access