WebBrowser Control for Visual Basic 6.0 Users

The WebBrowser control in Visual Basic 6.0 is replaced by the Windows Forms WebBrowser control in Visual Basic 2008. The names of some properties, methods, events, and constants are different, and in some cases there are differences in behavior.

Conceptual Differences

The Visual Basic 6.0 WebBrowser control, also known as the Microsoft Internet Controls or Shdocvw.dll, is an ActiveX control that allows you to host Internet Explorer inside your application.

The Visual Basic 2008 WebBrowser control provides a managed wrapper for the WebBrowser ActiveX control. This lets you display Web pages in your Windows Forms client applications. You can use the WebBrowser control to duplicate Internet Explorer Web browsing functionality in your application, or you can disable default Internet Explorer functionality and use the control as a simple HTML document viewer. You can also use the control to add DHTML-based user-interface elements to your form and hide the fact that they are hosted in the WebBrowser control. This approach lets you seamlessly combine Web controls with Windows Forms controls in a single application.

Internet Explorer Object

The Visual Basic 6.0 Microsoft Internet Controls consist of two components: the WebBrowser control and an Internet Explorer object that allows you to control an instance of Internet Explorer through OLE Automation.

There is no equivalent for the Internet Explorer object in Visual Basic 2008, and its related properties, methods, and events no longer exist. OLE Automation is no longer supported; you can control an external instance of Internet Explorer using a scripting language such as VBScript.

Document Property

In Visual Basic 6.0, the Document property returns a string containing the name of an HTML document; in Visual Basic 2008, it returns the HTML document itself.

Refresh, Refresh2 Methods

The Visual Basic 6.0 Refresh2 method takes a parameter specifying the refresh level; the Visual Basic 2008 Refresh method has an optional parameter that can be used to specify the refresh level.

WebBrowser Control Property, Method, and Event Equivalencies

The following tables list Visual Basic 6.0 properties, methods, and events, along with their Visual Basic 2008 equivalents. Those properties, methods, and events that have the same name and behavior are not listed. All Visual Basic 2008 enumerations map to the System.Windows.Forms namespace unless otherwise noted.

This table provides links to topics explaining behavior differences. Where there is no direct equivalent in Visual Basic 2008, links are provided to topics that present alternatives.

Properties

Visual Basic 6.0

Visual Basic 2005 Equivalent

AddressBar

New implementation. This was a property of the Internet Explorer object.

Application

New implementation. This was a property of the Internet Explorer object.

Busy

IsBusy

Container

Parent

Document

Document

NoteNote:
In Visual Basic 6.0, the Document property returns a string containing the name of an HTML document; in Visual Basic 2008, it returns the HTML document itself.

DragIcon

DragMode

New implementation. For more information, see Drag and Drop for Visual Basic 6.0 Users.

FullName

New implementation. This was a property of the Internet Explorer object.

Height

Height, Size

NoteNote:
Coordinates are handled differently in Visual Basic 2008. For more information, see Coordinate System for Visual Basic 6.0 Users.

HelpContextID

New implementation. For more information, see Help Support for Visual Basic 6.0 Users.

HWnd

Handle

Index

New implementation. For more information, see Control Arrays for Visual Basic 6.0 Users.

Left

Left

NoteNote:
Coordinates are handled differently in Visual Basic 2008. For more information, see Coordinate System for Visual Basic 6.0 Users.

LocationName

LocationURL

New implementation. This was a property of the Internet Explorer object.

MenuBar

New implementation. This was a property of the Internet Explorer object.

Offline

IsOffline

Parent

FindForm method

Path

New implementation. This was a property of the Internet Explorer object.

RegisterAsBrowser

New implementation. This was a property of the Internet Explorer object.

RegisterAsDropTarget

AllowWebBrowserDrop

Resizable

New implementation. This was a property of the Internet Explorer object.

Silent

ScriptErrorsSuppressed

StatusBar

StatusText

New implementation. This was a property of the Internet Explorer object.

TheaterMode

New implementation. This was a property of the Internet Explorer object.

ToolBar

New implementation. This was a property of the Internet Explorer object.

ToolTipText

ToolTip component.

For more information, see ToolTip Support for Visual Basic 6.0 Users.

Top

Top

NoteNote:
Coordinates are handled differently in Visual Basic 2008. For more information, see Coordinate System for Visual Basic 6.0 Users.

TopLevelContainer

New implementation. This was a property of the Internet Explorer object.

Type

DocumentType

WhatsThisHelpID

New implementation. For more information, see Help Support for Visual Basic 6.0 Users.

Width

Width, Size

NoteNote:
Coordinates are handled differently in Visual Basic 2008. For more information, see Coordinate System for Visual Basic 6.0 Users.

Methods

Visual Basic 6.0

Visual Basic 2005 Equivalent

ClientToWindow

PointToClient

Drag

New implementation. For more information, see Drag and Drop for Visual Basic 6.0 Users.

ExecWB

New implementation. This was a method of the Internet Explorer object.

GetProperty

New implementation. This was a method of the Internet Explorer object.

Move

SetBounds

NoteNote:
Coordinates are handled differently in Visual Basic 2008. For more information, see Coordinate System for Visual Basic 6.0 Users.

Navigate2

New implementation. This was a method of the Internet Explorer object.

OLEDrag

New implementation. For more information, see Drag and Drop for Visual Basic 6.0 Users.

PutProperty

New implementation. This was a method of the Internet Explorer object.

QueryStatusWB

New implementation. This was a method of the Internet Explorer object.

Quit

New implementation. This was a method of the Internet Explorer object.

Refresh

Refresh2

Refresh

NoteNote:
The Visual Basic 6.0 Refresh2 method took a parameter specifying the refresh level; the Visual Basic 2008 Refresh method has an optional parameter that can be used to specify the refresh level.

SetFocus

Focus

ShowBrowserBar

New implementation. This was a method of the Internet Explorer object.

ShowWhatsThis

New implementation. For more information, see Help Support for Visual Basic 6.0 Users.

ZOrder

BringToFront or SendToBack function

Events

Visual Basic 6.0

Visual Basic 2005 Equivalent

BeforeNavigate

BeforeNavigate2

Navigating

ClientToHostWindow

New implementation. This was an event of the Internet Explorer object.

CommandStateChanged

CanGoBackChanged

CanGoForwardChanged

DblClick

DoubleClick

DocumentComplete

DownloadBegin

DownloadComplete

DocumentCompleted

DragDrop

DragOver

New implementation. For more information, see Drag and Drop for Visual Basic 6.0 Users.

GotFocus

Enter

LostFocus

Leave

NavigateComplete

NavigateComplete2

Navigated

NavigateError

New implementation. This was an event of the Internet Explorer object.

NewWindow

NewWindow2

NewWindow3

NewWindow

OnFullScreen

OnMenuBar

OnQuit

OnStatusBar

OnTheaterMode

OnToolBar

OnVisible

New implementation. This was an event of the Internet Explorer object.

PrintTemplateInstantiation

PrintTemplateTearDown

PrivacyImpactedStateChange

New implementation. This was an event of the Internet Explorer object.

ProgressChange

ProgressChanged

PropertyChange

New implementation. This was an event of the Internet Explorer object.

SetSecureLockIcon

EncryptionLevelChanged

StatusTextChange

StatusTextChanged

TitleChange

DocumentTitleChanged

UpdatePageStatus

New implementation. This was an event of the Internet Explorer object.

Validate

Validating

WindowClosing

WindowSetHeight

WindowSetLeft

WindowSetResizable

WindowSetTop

WindowSetWidth

New implementation. This was an event of the Internet Explorer object.

Upgrade Notes

When a Visual Basic 6.0 application is upgraded to Visual Basic 2008, any WebBrowser controls are upgraded to Windows Forms WebBrowser controls, and properties, methods and events are upgraded to their equivalents. Where there may be differences in behavior, upgrade comments are inserted into the code.

See Also

Tasks

How to: Use the WebBrowser Control in the .NET Compact Framework

Reference

WebBrowser Control Overview

Other Resources

WebBrowser Control (Windows Forms)