refrencing a new instance of a webbrowser
hey all
ive created a form with a tabcontrol and im also successfully able to create new tabs with new webbrowser instances on them during runtime but even when the new tab is open still the new url that i type in the textbox it gets navigated on the old tab only.
How do i make the new url typed open in the new tab
since i wont know the new tabpage name?
Re: refrencing a new instance of a webbrowser
How exactly are you creating new instances? Can you post some code?
Re: refrencing a new instance of a webbrowser
hey man im sorry i posted this in the wrong forum this is meant for vb 2005 express edition
VB Code:
Public Class Form1
Public browser As WebBrowser
Private Sub ToolStripButton6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton6.Click
If Me.TabControl1.SelectedTab.Focus Then
WebBrowser1.Navigate(ToolStripComboBox1.Text)
Else
Me.TabControl1.SelectedTab.Focus()
browser.Navigate(ToolStripComboBox1.Text)
End If
End Sub
' Updates the title bar with the current document title.
Private Sub webBrowser1_DocumentTitleChanged( _
ByVal sender As Object, ByVal e As EventArgs) _
Handles WebBrowser1.DocumentTitleChanged
Me.Text = WebBrowser1.DocumentTitle
TabPage1.Text = WebBrowser1.DocumentTitle
End Sub
Private Sub NewTabToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewTabToolStripMenuItem.Click
Me.TabControl1.TabPages.Add(New BrowserTabPage)
Me.TabControl1.SelectedTab.Focus()
End Sub
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
End Sub
Private Sub TabPage1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles TabPage1.Click
End Sub
End Class
Public Class BrowserTabPage
Inherits TabPage
Private browser As WebBrowser
Public Sub New()
MyBase.New()
Me.browser = New WebBrowser
Me.browser.Dock = DockStyle.Fill
Me.Controls.Add(Me.browser)
End Sub
Public Sub New(ByVal url As String)
Me.New()
Me.browser.Navigate(url)
End Sub
End Class
Re: refrencing a new instance of a webbrowser
Moved, and added vbcode tags