'webbrowser.documentCompleted + = procedure'从c#转换为vb.net

时间:2016-06-03 13:12:45

标签: c# vb.net code-translation

通常当我需要将代码从c#转换为vb.net时,我会使用此链接 http://converter.telerik.com/ 但是找一个旧答案(WebBrowser Control in a new thread

我发现这条线我不明白,并且转换器没有翻译:

br.DocumentCompleted + = browser_DocumentCompleted;

private void runBrowserThread(Uri url) {
var th = new Thread(() => {
    var br = new WebBrowser();
    br.DocumentCompleted += browser_DocumentCompleted;
    br.Navigate(url);
    Application.Run();
});
th.SetApartmentState(ApartmentState.STA);
th.Start();
}

void browser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) {
    var br = sender as WebBrowser;
    if (br.Url == e.Url) {
        Console.WriteLine("Natigated to {0}", e.Url);
        Application.ExitThread();   // Stops the thread
    }
}

有人知道翻译吗?

由于

1 个答案:

答案 0 :(得分:1)

该行正在为WebBrowser.DocumentCompleted事件添加事件处理程序,指向browser_DocumentCompleted方法。

这是翻译: AddHandler br.DocumentCompleted, AddressOf browser_DocumentCompleted