March 19, 2019
Hot Topics:

Creating a Web Browser

  • November 20, 2002
  • By Karl Moore
  • Send Email »
  • More Articles »

There are two properties and one main event that will help you build Internet-aware applications with the WebBrowser control:

Location Name

When you're at a site, you can retrieve the title as would typically appear in the Internet Explorer title bar caption by retrieving the LocationName property. Here's an example:

MsgBox WebBrowser1.LocationName

Location URL

You can retrieve the current Web address by grabbing the LocationURL property, as would typically appear in the Internet Explorer Address bar. Here's an example:

MsgBox WebBrowser1.LocationURL

Document Complete

The DocumentComplete event of the WebBrowser control fires up when any Web page has finished loading. This is the ideal event under which to write code to update possible title and address bars. Here's an example:

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As _
Object, URL As Variant)
	Me.Caption = WebBrowser1.LocationName
    txtWebAddress.Text = WebBrowser1.LocationURL
End Sub

Page 4 of 8

Comment and Contribute


(Maximum characters: 1200). You have characters left.



Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date