Fog Creek Software
Discussion Board




Welcome! and rules

Joel on Software

Opening Internet Explorer in a Visual Basic App.

Hi,

I am new to VB.NET (new to VB, to begin with).

I am using the google API in a Visual Basic app, and want to open a browser window (IE) for a query generated from the app.

The app is quite similar to the demo's provided by google for .NET. A text box where one can type in the query. I want the results of this query to be displayed in IE. How would I do this?

here is an example just to make things more clearer:

If I type in "Joel on Software" in the text box, a new instance of IE opens up with these results.

Thanks,

Prakash S
Monday, December 16, 2002

Do you want a new, separate IE window to start up? If so, the easiest thing to do is use the System.Diagnostics.Process.Start() method to start the url - that'll launch the users default browser.

Do you want to launch a browser embedded in your app? Then you'll need to use the MS webbrowser control. I've done that before, but it's long ago enough that I don't want to guess at the details without trying them again.

Chris Tavares
Monday, December 16, 2002

Since you're using VB, you could also look at using the Shell function built in to VB.NET.

Chris Tavares
Monday, December 16, 2002

If you're interested in embedding the web browser control, here's a couple articles that deal with it.  Though, they're using C# so you may have to convert the code.

CodeProject: Using the WebBrowser Control in .Net
http://www.codeproject.com/csharp/webbrowser.asp

CodeProject: .Net MSIE OnBeforeNavigate2 Fix
http://www.codeproject.com/useritems/iefix.asp

The second article deals with adding an event handler to OnBeforeNavigate, so you can catch the browser clicks before the page is loaded.

I've been using the WebBrowser control for a little while, and I like it. 

rick
Wednesday, December 18, 2002

Chris,

Thanks. It works like a charm.

Rick, I will look into that as well. thanks.

Prakash S
Sunday, December 22, 2002

*  Recent Topics

*  Fog Creek Home