Jump to content
Sign in to follow this  
oliveira1991

Projecto Navegador

Recommended Posts

oliveira1991

Boas Pessoal,

inicie um novo projeto pessoal de fazer um browser de internet, tenho aqui serias duvidas.

o programa já adiciona novos separadores, mas quando tento que ele aceda a uma pagina de internet abre sempre no primeiro separador,

exemplo

separador 1 = site x

e eu queria no separador 2 = site Y, mas o que ele faz é o seguinte, quando eu faço para a pesquisa do site ele mostra o site y sempre no separador 1, ao qual teria de ter o site x.

o código que estou a utilizar é:

Dim t As New WebBrowser
	t = WebBrowser1
	If TabControl1.SelectedTab.Focus() Then
		t.Navigate(TextBox1.Text)
	End If

o no botão adicionar novo separador tenho:

Dim t As New WebBrowser
    Dim tab As New TabPage
    t = WebBrowser1
    TabControl1.TabPages.Add(tab)
    tab.Controls.Add(WebBrowser1)

Obr

Edited by oliveira1991

Live for ever

Share this post


Link to post
Share on other sites
nelsonr

Um exemplo de como adicionar e remover tabs com o control webbrowser (simular browser multitab)

Public Class Form3

   Private Sub Form3_Load(sender As Object, e As EventArgs) Handles MyBase.Load
       '
       AddTab()
   End Sub

   Private Sub AddTab()
       '
       Dim webBrowser As New WebBrowser
       webBrowser.Navigate("about:blank")
       webBrowser.Width = TabControl1.Width - 620
       webBrowser.Height = TabControl1.Height - 400
       webBrowser.Anchor = CType(System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left Or System.Windows.Forms.AnchorStyles.Right, System.Windows.Forms.AnchorStyles)
       webBrowser.ScrollBarsEnabled = True
       '
       Dim tabPage As New TabPage
       tabPage.Controls.Add(webBrowser)
       '
       TabControl1.TabPages.Add(tabPage)
   End Sub

   Private Sub btnGo_Click(sender As Object, e As EventArgs) Handles btnGo.Click
       Dim webbrowser As WebBrowser = DirectCast(TabControl1.SelectedTab.Controls(0), WebBrowser)
       webbrowser.Navigate(txtURL.Text)
   End Sub

   Private Sub btnAddTab_Click(sender As Object, e As EventArgs) Handles btnAddTab.Click
       AddTab()
   End Sub

   Private Sub btnRemoveTab_Click(sender As Object, e As EventArgs) Handles btnRemoveTab.Click
       TabControl1.TabPages.Remove(TabControl1.SelectedTab)
       If TabControl1.TabPages.Count = 0 Then
           AddTab()
       End If
   End Sub

   Private Sub TabControl1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles TabControl1.SelectedIndexChanged
       If TabControl1.SelectedIndex >= 0 Then
           Dim webbrowser As WebBrowser = DirectCast(TabControl1.SelectedTab.Controls(0), WebBrowser)
           txtURL.Text = webbrowser.Url.AbsoluteUri
       End If
   End Sub
End Class

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.