通常当我需要将代码从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
}
}
有人知道翻译吗?
由于
答案 0 :(得分:1)
该行正在为WebBrowser.DocumentCompleted
事件添加事件处理程序,指向browser_DocumentCompleted
方法。
这是翻译:
AddHandler br.DocumentCompleted, AddressOf browser_DocumentCompleted