を実行に失敗:getElementsByTagNameのは、このコードは、次のエラーで実行に失敗し
An unhandled exception of type 'System.NullReferenceException' occurred in Miner_W.exe
Additional information: Object reference not set to an instance of an object.
public void obturl()
{
string url="http://www.google.com";
WebBrowser wb = new WebBrowser();
wb.Navigate (new Uri (url));
HtmlElementCollection elementcolls = wb.Document.GetElementsByTagName("img");
foreach (HtmlElement elementcoll in elementcolls)
{
listBox1.Items.Add(elementcoll.GetAttribute("scr"));
}
/*string result = elementcoll[i].GetAttribute("src");*/
}
恐ろしい!できます。あなたは、 "wb.DocumentCompleted + =(s、e)=>" – Megaman
@Thomasshi - '+ =' - [subscribe]というステートメントの "+、=> //msdn.microsoft.com/en-us/library/ms366768.aspx)をイベントに追加します。 '=>' - '(https://msdn.microsoft.com/en-us/library/bb311046.aspx)。 –