Web Browser Help


New member
Nov 15, 2006
Programming Experience
Hi ya'll,

I have three questions that I have been beating myself up over for the past 3 weeks. I am making a web browser for a school project. And wouldnt ya know I ran into three problems:

1) How do you disable the back button so the user cannot go back past the initial loaded webpage. My program crashes everytime I do that. I thought disabling the button at points would work but it still finds a way to crash.

2) How do you set up a "Save Favorites" type button?

3) (the most important one) How do you do a "New window" or Ctrl+N with the form so that the new window is not dependent on the original window(ie when i close the original window the rest of them don't close)

Thanks for your help in advance JOE


VB.NET Forum Moderator
Staff member
Aug 17, 2004
Sydney, Australia
Programming Experience
1. You would manipulate the buttons like so:
myBackButton.Enabled = myWebBrowser.CanGoBack
myForwardButton.Enabled = myWebBrowser.CanGoForward
You would place this code in the method that handles the Navigating, Navigated or DocumentCompleted event. I'm not sure which would be the most appropriate but a bit of testing would tell you.

2. I would suggest creating a Favourite class and a FavouriteCollection class. You can then serialise and deserialise a FavouriteCollection object to an XML file to save and load your favourites. If XML serialisation is a bit beyond you at this stage then you can just use StreamReaders and StreamWriters and use a text file instead.

3. It's not an easy thing to do within a single application in VB.NET 2003. I would suggest that when you create a new window that you actually start a new process, so you will be running more than one instance of your application. If you need to pass a URL to the new window you can do that via a commandline argument. See the Environment.GetCommandLineArgs method for more information.
Top Bottom