August 31, 2014
Hot Topics:
RSS RSS feed Download our iPhone app

Creating a Web Browser

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

The main commands for controlling your WebBrowser control are very simple. Let's cover them now:

Visiting a Site

To visit a site, call the Navigate method, passing a Web address. Once a site has loaded into the WebBrowser control, the surfer can use it just like Internet Explorer. Let's look at two quick samples for opening a site:

WebBrowser1.Navigate (txtWebAddress.Text)
WebBrowser1.Navigate ("http://www.vbworld.com/")

Navigating a Site

Once you're at a site, you may want to move around, going backwards and forwards. You can do that easily via the GoBack and GoForward methods, like this:

WebBrowser1.GoBack
WebBrowser1.GoForward

Refreshing and Stopping

If a site is taking too long to load, the user might want to stop it, then refresh. Or perhaps the surfer just needs to refresh and view the latest information. The Stop and Refresh methods of the WebBrowser control work just like Internet Explorer and can be run like this:

WebBrowser1.Stop
WebBrowser1.Refresh

Searching for Home

To visit the default home page, you can run the simple GoHome method. And if you want to display the default search page, try out the GoSearch method. Here's an example:

WebBrowser1.GoHome
WebBrowser1.GoSearch

Handling Errors

It's worth noting that a lot of WebBrowser commands are prone to silly, menial errors, so feel free to use 'On Error Resume Next' statements liberally.





Page 3 of 8



Comment and Contribute

 


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

 

 


Sitemap | Contact Us

Rocket Fuel