VBObject Method

Applies to TestComplete 15.42, last modified on September 08, 2022

Description

Use this method to obtain a scripting interface to the specified object of a Visual Basic 6.0 application (these applications are always “open” to TestComplete). The resulting object contains both VB and TestComplete methods, properties, events and actions.

Declaration

TestObj.VBObject(Name)

TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section
Name [in]    Required    String    
Result Object

Applies To

The method is applied to the following objects:

View Mode

To view this method in the Object Browser panel and in other panels and dialogs, activate the Advanced view mode.

Parameters

The method has the following parameter:

Name

The name of the desired object. This can be the object’s name as it is specified in the tested application’s source code (the string that is returned by the object’s “native” Name property) or the name generated by TestComplete (when the “native” Name property is empty). TestComplete generates the name using the object’s class name and an index. To learn the generated name, explore your application in the Object Browser.

Result Value

The VBObject method returns an object that provides a scripting interface to an object located in a Visual Basic 6.0 application. If TestComplete cannot access the specified object (for example, this object does not exist), the method will return an empty stub object and post an error message to the test log. To determine whether VBObject returns a valid object, use the Exists property of the resultant object. If this property returns False, then the returned object is a stub object and the call to VBObject was not successful.

Remarks

The returned object contains both methods and properties defined in the application code as well as methods, properties and actions provided by TestComplete. The returned object may hold two or more methods and properties having the same name. When you call such a method or property, a naming conflict will occur. To avoid it and to specify which method or property is to be called, use the NativeVBObject namespace.

The VBObject method is available only if the Visual Basic Application Support plugin is installed. Otherwise, the method is absent in the method list of the TestObj object.
If the plugin is installed, you cannot use the Window method to address windows of your Visual Basic applications, you should use VBObject instead.

Example

To view an example that demonstrates how to use the VBObject method, see Addressing Objects in Visual Basic Applications.

See Also

Addressing Objects in Visual Basic Applications
Object Browser Naming Notation
Using Namespaces
About Open Applications
VBObject Method
WaitVBObject Method
Window Method
WaitWindow Method

Highlight search results