-1

这是代码:

Private Sub GeckoWebBrowser1_Navigated(sender As Object, e As Gecko.GeckoNavigatedEventArgs) Handles GeckoWebBrowser1.Navigated
    ToolStripTextBox1.Text = GeckoWebBrowser1.Url.OriginalString
    **Parent.Text = GeckoWebBrowser1.Site.Name.ToString** 
    ''GeckoWebBrowser1.DocumentTitle.ToString
    ''GeckoWebBrowser1.Site.Name.ToString()
End Sub

如果我启动程序 VB 说我 System.NullReferenceException 未被用户代码处理在粗体线上。

4

2 回答 2

0

尝试将您的代码更改为:

Private Sub GeckoWebBrowser1_Navigated(sender As Object, e As Gecko.GeckoNavigatedEventArgs) Handles GeckoWebBrowser1.Navigated
    ToolStripTextBox1.Text = GeckoWebBrowser1.Url.OriginalString
    if GeckoWebBrowser1 isnot nothing AndAlso GeckoWebBrowser1.Site isnot nothing then
    Parent.Text = GeckoWebBrowser1.Site.Name.ToString
    ''GeckoWebBrowser1.DocumentTitle.ToString
    ''GeckoWebBrowser1.Site.Name.ToString()
    end if
End Sub
于 2013-05-29T09:26:15.233 回答
0

好的,我有。我把计时器

Parent.Text = GeckoWebBrowser1.Site.Name.ToString

因为应用程序在加载站点之前不会获得站点名称

于 2013-05-30T10:59:46.440 回答