O'Reilly logo

VB.NET Language in a Nutshell, Second Edition by Steven Roman PhD, Paul Lomax, Ron Petrusha

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

GetObject Function

Class

Microsoft. VisualBasic.Interaction

Syntax

GetObject([pathname] [, class])
pathname (optional; String)

The full path and name of the file containing the COM (or ActiveX) object.

class (optional; String)

The class of the object. The class argument has these parts:

Appname (required; String)

The name of the application.

Objecttype (required; String)

The class of object to create, delimited from Appname by using a point ( . ). For example, Appname.Objecttype.

Return Value

Returns a reference to an ActiveX object

Description

Accesses an ActiveX server held within a specified file

Rules at a Glance

  • Although both pathname and class are optional, at least one parameter must be supplied.

  • In situations where you cannot create a project-level reference to an ActiveX object, you can use the GetObject function to assign an object reference from an external ActiveX object to an object variable.

  • GetObject is used when there is a current instance of the ActiveX object; to create the instance, use the CreateObject function.

  • If you specify pathname as a zero-length string, GetObject will return a new instance of the object — unless the object is registered as single instance, in which case the current instance will be returned.

  • If you omit the pathname, the current instance of the object will be returned.

  • An error is generated if pathname is not specified and no current instance of the object can be found.

  • The object variable you will use within your program to hold a reference ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required