Reference for Visual Basic Developers

Reference for Visual Basic Developers

The following sections are a reference guide for using the WebBrowser control with Microsoft® Visual Basic®. This reference covers all the supported properties, methods, and events associated with the WebBrowser and InternetExplorer objects.


Objects

This section describes the WebBrowser and InternetExplorer objects.


WebBrowser Object

Description

The WebBrowser object adds browsing capabilities to your applications. Applications hosting this ActiveX™ Control will support browsing sites on the World Wide Web, as well as directories on the local computer and on network servers.

Properties

AddressBar ,Application, Busy, Container, Document, FullScreen, Height, Left, LocationName, LocationURL, MenuBar, Offline, Parent, ReadyState, RegisterAsBrowser, RegisterAsDropTarget, Resizable, Silent, StatusBar, StatusText, TheaterMode, ToolBar, Top, TopLevelContainer, Type, Visible, Width

Methods

ExecWB, GoBack, GoForward, GoHome, GoSearch, Navigate, Navigate2, Quit, Refresh, Refresh2, ShowBrowserBar, Stop

Events

BeforeNavigate2, CommandStateChange, DocumentComplete, DownloadBegin, DownloadComplete, NavigateComplete2, NewWindow2, OnFullScreen, OnMenuBar, OnStatusBar, OnTheaterMode, OnToolBar, OnVisible, ProgressChange, StatusTextChange, TitleChange


InternetExplorer Object

Description

The InternetExplorer object controls a remote instance of the Internet Explorer application through OLE Automation.

Properties

AddressBar, Application, Busy, Container, Document, FullName, FullScreen, Height, HWND, Left, LocationName, LocationURL, MenuBar, Name, Offline, Parent, Path, ReadyState, RegisterAsBrowser, RegisterAsDropTarget, Resizable, Silent, StatusBar, StatusText, TheaterMode, ToolBar, Top, TopLevelContainer, Type, Visible, Width

Methods

ClientToWindow, ExecWB, GetProperty, GoBack, GoForward, GoHome, GoSearch, Navigate, Navigate2, PutProperty, QueryStatusWB, Quit, Refresh, Refresh2, ShowBrowserBar, Stop

Events

BeforeNavigate2, CommandStateChange, DocumentComplete, DownloadBegin, DownloadComplete, NavigateComplete2, NewWindow2, OnFullScreen, OnMenuBar, OnQuit, OnStatusBar, OnTheaterMode, OnToolBar, OnVisible, ProgressChange, PropertyChange, StatusTextChange, TitleChange


Properties

This section describes the properties associated with the WebBrowser control.


AddressBar Property

Description

Returns or sets a value that determines whether the Internet Explorer application URL address bar is visible or hidden.

Syntax

object.AddressBar

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The WebBrowser object ignores the AddressBar property.

Applies To

InternetExplorer, WebBrowser


Application Property

Description

Returns the automation object supported by the application that contains the WebBrowser control, if the object is accessible; otherwise, this property returns the WebBrowser control's automation object.

Syntax

object.Application

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.

Remarks

Use this property with the Set and CreateObject commands or with the GetObject command to create and manipulate an instance of the Internet Explorer application as shown in the following early binding example.

Dim IE As SHDocVw.InternetExplorer

Set IE = CreateObject("InternetExplorer.Application")

Applies To

InternetExplorer, WebBrowser


Busy Property

Description

Returns a Boolean value indicating whether the WebBrowser control or Internet Explorer application is engaged in a navigation or downloading operation. If the control is busy, you can use the Stop method to cancel the navigation or download operation before it is completed.

Syntax

object.Busy

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.

Remarks

The Busy property returns TRUE if a download or navigation operation is currently in progress, or FALSE otherwise.

Applies To

InternetExplorer, WebBrowser

See Also

Stop


Container Property

Description

Returns an object that evaluates to the container of the WebBrowser control, if any.

Syntax

object.Container

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.

Applies To

InternetExplorer, WebBrowser

See Also

Document


Document Property

Description

Returns the automation object of the active document, if any. This provides access to the contents of the HTML document through the object model. For more information, see the document object section in the Dynamic HTML reference.

Syntax

object.Document

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.

Applies To

InternetExplorer, WebBrowser

See Also

Container


FullName Property

Description

Returns a string that evaluates to the fully qualified path of the executable file that contains the Internet Explorer application.

Syntax

object.FullName

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.

Applies To

InternetExplorer


FullScreen Property

Description

Returns or sets a value indicating whether the Internet Explorer window is maximized.

Syntax

object.FullScreen [= value]

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.
value Optional. A Boolean expression that determines whether Internet Explorer is maximized. If TRUE, the browser window is maximized; if FALSE, it is not. The default value is FALSE.

Remarks

The WebBrowser object ignores the FullScreen property.

Applies To

InternetExplorer, WebBrowser


Height Property

Description

Returns or sets the vertical dimension, in pixels, of the frame window that contains the WebBrowser control.

Syntax

object.Height [= height]

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.
height Optional. A long integer value that specifies the vertical dimension of the frame window, in pixels.

Applies To

InternetExplorer, WebBrowser

See Also

ClientToWindow, Width


HWND Property

Description

Returns the window handle to the Internet Explorer main window.

Syntax

object.HWND

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.

Applies To

InternetExplorer


Left Property

Description

Returns or sets the distance between the internal left edge of the WebBrowser control and the left edge of its container.

Syntax

object.Left [= distance]

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.
distance Optional. A long integer expression that specifies the distance between the internal left edge of the WebBrowser control and the left edge of its container.

Remarks

The Left property is measured in units depending on the coordinate system of its container. The values for this property change as the object is moved by the user or by code.

Applies To

InternetExplorer, WebBrowser


LocationName Property

Description

Returns a string that contains the name of the resource that the WebBrowser control is currently displaying. If the resource is an HTML page on the World Wide Web, the name is the title of that page. If the resource is a folder or file on the network or local computer, the name is the full path of the folder or file in the Universal Naming Convention (UNC) format.

Syntax

object.LocationName

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.

Applies To

InternetExplorer, WebBrowser

See Also

LocationURL


LocationURL Property

Description

Returns a string that contains the URL of the resource that the WebBrowser control or Internet Explorer application is currently displaying. If the resource is a folder or file on the network or local computer, the name is the full path of the folder or file in the Universal Naming Convention (UNC) format.

Syntax

object.LocationURL

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.

Applies To

InternetExplorer, WebBrowser

See Also

LocationName


MenuBar Property

Description

Returns or sets a value that determines whether the Internet Explorer application menu bar is visible or hidden.

Syntax

object.MenuBar [= value]

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.
value Optional. A Boolean expression that determines whether the menu bar is visible. If TRUE, the menu bar is visible; if FALSE, it is hidden. The default value is TRUE.

Remarks

Setting this property to FALSE prevents the user from accessing the File, Edit, View, Go, Favorites, and Help menus. This can be used for limiting the functionality of an Internet Explorer application from a controlling application.

Remarks

The WebBrowser object ignores the MenuBar property.

Applies To

InternetExplorer, WebBrowser


Name Property

Description

Returns a string that evaluates to the name of the Internet Explorer application—that is, "Microsoft Internet Explorer."

Syntax

object.Name

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.

Remarks

This property is read-only.

Applies To

InternetExplorer


Offline Property

Description

Returns or sets a value indicating whether the WebBrowser control is currently operating in offline mode. In offline mode, the browser is forced to read HTML pages from the local cache rather than from the source document.

Syntax

object.Offline [= value]

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.
value Optional. A Boolean expression that determines whether the WebBrowser control is in offline mode. If TRUE, the WebBrowser will read data about its current URL from its local cache; if FALSE, it will attempt to read the source document. The default value is FALSE.

Applies To

InternetExplorer, WebBrowser


Parent Property

Description

Returns an object that evaluates to the form on which the WebBrowser control is located, or to the automation object supported by Internet Explorer.

Syntax

object.Parent

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.

Applies To

InternetExplorer, WebBrowser


Path Property

Description

Returns a string that evaluates to the full path of the Internet Explorer application.

Syntax

object.Path

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.

Applies To

InternetExplorer


ReadyState Property

Description

Retrieves the ready state of the object. This will be one of the READYSTATE values.

Syntax

object.ReadyState

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.

Applies To

InternetExplorer, WebBrowser, READYSTATE


RegisterAsBrowser Property

Description

Returns or sets a value indicating whether the WebBrowser control is registered as a top-level browser for target name resolution.

Syntax

object.RegisterAsBrowser [= value]

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.
value Optional. A Boolean expression that determines whether Internet Explorer is registered as a top-level browser. If TRUE, the WebBrowser is registered as a top-level browser; if FALSE, it is not a top-level browser. The default value is FALSE.

Applies To

InternetExplorer, WebBrowser


RegisterAsDropTarget Property

Description

Returns or sets a value indicating whether the WebBrowser control is registered as a drop target for navigation.

Syntax

object.RegisterAsDropTarget [= value]

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.
value Optional. A Boolean expression that determines whether Internet Explorer is registered as a drop target for navigation. If TRUE, the WebBrowser is registered as a drop target; if FALSE, it is not a drop target. The default value is FALSE.

Applies To

InternetExplorer, WebBrowser


Resizable Property

Description

Sets or retrieves a value indicating whether the object can be resized.

Syntax

object.Resizable [= value]

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.
value Optional. A Boolean expression that sets the object's resizable property. If this value is True, the object can be resized. If this value is False, the object cannot be resized. The default value is True.

Remarks

The WebBrowser object ignores the Resizable property.

Applies To

InternetExplorer, WebBrowser


Silent Property

Description

Returns or sets a value indicating whether any dialog boxes can be shown.

Syntax

object.Silent [= value]

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.
value Optional. A Boolean expression that determines whether the WebBrowser can show any dialog boxes. If TRUE, dialog boxes will not be displayed; if FALSE, dialog boxes will be displayed. The default value is FALSE.

Applies To

InternetExplorer, WebBrowser


StatusBar Property

Description

Returns or sets a value that determines whether the status bar is visible.

Syntax

object.StatusBar [= value]

PartDescription
object Required. An object expression that evaluates to an InternetExplorer object.
value Optional. A Boolean expression that determines whether the status bar is visible. If TRUE, the status bar is visible; if FALSE, it is hidden. The default is TRUE.

Remarks

The WebBrowser object ignores the StatusBar property.

Applies To

InternetExplorer, WebBrowser

See Also

StatusText, StatusTextChange, ToolBar, Visible


StatusText Property

Description

Returns or sets the text for the status bar.

Syntax

object.StatusText [= value]

PartDescription
object Required. An object expression that evaluates to an InternetExplorer object.
value Optional. A string that evaluates to the text for the status bar.

Remarks

The WebBrowser object ignores the StatusText property.

Applies To

InternetExplorer, WebBrowser

See Also

StatusBar, StatusTextChange


TheaterMode Property

Description

Returns or sets a value indicating whether Internet Explorer is in theater or normal window mode. In theater mode, the Internet Explorer main window fills the entire screen and displays a toolbar with a minimal set of navigational buttons. A status bar is also provided in the upper right-hand corner of the screen. Channels, Search, History, and Favorites browser bars appear (if enabled) as an autohide pane on the left edge of the screen in theater mode.

Syntax

object.TheaterMode [= value]

PartDescription
object Required. An object expression that evaluates to an object in the Applies To list.
value Optional. A Boolean expression that determines whether Internet Explorer is in theater or normal window mode. If TRUE, the object is in theater mode; if FALSE, it is in normal mode. The default value is FALSE.

Remarks

The WebBrowser object ignores the TheaterMode property.

Applies To

InternetExplorer, WebBrowser

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.