views:

425

answers:

3

I'm trying to create a little executable that when launched opens an IE browser to various websites like news sites all in different tabs. for example, a tab for wsj, nytimes, etc. How do I access IE with vb.net? What reference do I need to add? I can't find any sample code that I can make work I think it is because I am missing a library in my assembly?

A: 

You can't open them in tabs:

http://stackoverflow.com/questions/921560/programmatically-open-a-new-tab-in-ie7

Stu
But, I am fine with adjusting a tab setting on my browser. I have done this and still cannot get it to open with tabs. I now open 6 instances of my browser. I'd prefer to open one instance with 6 tabs. What is winforms webbrowser control?
unsure
Microsoft has decided that applications don't get to decide, period. They might add this in IE9 but don't hold your breath. The WinForms webbrowser control allows you to put an instance of IE on your forms.
Stu
A: 

Is your application a console application? You can't create multiple tabs, but you can use a System.Diagnostics.Process to launch individual instances of Internet Explorer. You should be able to simply specify the full address of the website as the Process to run, similar to how you can put "http://www.wsj.com" into a run prompt, which will launch your default browser with the Wall Street Journal's website.

If you are using WinForms, you could always use a WebBrowser control, but that has limitations for tabs as well.

AJ
A: 
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    OpenURL("www.google.com")

End Sub


Private Sub OpenURL(ByVal URL As String)
    System.Diagnostics.Process.Start(URL)

End Sub

'Or

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    Dim TheBrowser As Object = CreateObject("InternetExplorer.Application")
    TheBrowser.Visible = True
    TheBrowser.Navigate("www.google.com")


End Sub

'Or add Reference SHDocVw.dll By Browsing System32

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    Dim TheBrowser = New SHDocVw.InternetExplorerMedium
    TheBrowser.Visible = True
    TheBrowser.Navigate(URL:="http://www.google.com")

End Sub
kavian