VB.NET选项卡控件Web浏览器?

VB.NET选项卡控件Web浏览器?,vb.net,Vb.net,我对此有点陌生,但我正在开发一款带有标签浏览的web浏览器 创建一个新选项卡时,它会在其中创建一个web浏览器——但我希望在浏览器加载完成时调用一个函数。我无法在函数中创建私有子函数,因此我不确定应该做什么。有什么想法吗 我的代码: Function addtab() Dim myTabPage As New TabPage() Dim theweb As New WebBrowser myTabPage.Text = "TabPage Test" & (Tab

我对此有点陌生,但我正在开发一款带有标签浏览的web浏览器

创建一个新选项卡时,它会在其中创建一个web浏览器——但我希望在浏览器加载完成时调用一个函数。我无法在函数中创建私有子函数,因此我不确定应该做什么。有什么想法吗

我的代码:

Function addtab()
    Dim myTabPage As New TabPage()
    Dim theweb As New WebBrowser

    myTabPage.Text = "TabPage Test" & (TabControl1.TabPages.Count + 1)
    TabControl1.TabPages.Add(myTabPage)

    theweb.GoHome()
    theweb.Parent = myTabPage
    theweb.Visible = True
    theweb.Dock = DockStyle.Fill
    Return True
End Function

谢谢

听起来您想创建一个新的webBrowser对象,将其停靠在您创建的新选项卡页面中,然后在完成加载后让webBrowser执行某些操作,对吗

像这样的东西怎么样

Public Class Form1

Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
    addtab()
End Sub

Function addtab()
    Dim myTabPage As New TabPage()
    Dim theweb As New WebBrowser()
    AddHandler theweb.DocumentCompleted, New WebBrowserDocumentCompletedEventHandler(AddressOf Run_Me_On_Load)
    myTabPage.Text = "TabPage Test" & (TabControl1.TabPages.Count + 1)
    TabControl1.TabPages.Add(myTabPage)
    theweb.Navigate("http://justinchoponis.com")
    theweb.Parent = myTabPage
    theweb.Visible = True
    theweb.Dock = DockStyle.Fill
    Return True
End Function


Public Sub Run_Me_On_Load(sender As Object, e As EventArgs)
    MessageBox.Show("Finished loading")
End Sub

End Class听起来像是要创建一个新的webBrowser对象,将其停靠在您创建的新选项卡页中,然后让webBrowser在加载完成后执行某些操作,对吗

像这样的东西怎么样

Public Class Form1

Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
    addtab()
End Sub

Function addtab()
    Dim myTabPage As New TabPage()
    Dim theweb As New WebBrowser()
    AddHandler theweb.DocumentCompleted, New WebBrowserDocumentCompletedEventHandler(AddressOf Run_Me_On_Load)
    myTabPage.Text = "TabPage Test" & (TabControl1.TabPages.Count + 1)
    TabControl1.TabPages.Add(myTabPage)
    theweb.Navigate("http://justinchoponis.com")
    theweb.Parent = myTabPage
    theweb.Visible = True
    theweb.Dock = DockStyle.Fill
    Return True
End Function


Public Sub Run_Me_On_Load(sender As Object, e As EventArgs)
    MessageBox.Show("Finished loading")
End Sub

下课

我爱你!谢谢你太棒了-我从没想过这是可能的!迟到总比不做好非常感谢。我爱你!谢谢你太棒了-我从没想过这是可能的!迟到总比不做好非常感谢。