I have code such as this:
string url = "http://en.wikipedia.org/wiki/Earth";
System.Windows.Forms.WebBrowser wb = new System.Windows.Forms.WebBrowser();
wb.Url = new Uri(url);
but after that last line wb.Url is always null.
Also, if the last line is replaced with:
wb.Navigate(url);
wb.Url and wb.Document are always null. What is going on here? This is the same exact code as in documentation, but it's not working.
I also tried to use SHdocVw:
object o = null;
InternetExplorer ie = new InternetExplorer();
IWebBrowser2 wb1 = (IWebBrowser2)ie;
wb1.Navigate(url, ref o, ref o, ref o, ref o);
HtmlDocument htmlDoc = (HtmlDocument) wb1.Document;
HtmlElementCollection children = htmlDoc.All;
but the wb1.Document returns an E_FAIL HRESULT.
Any help would be appreciated--I'm brand new to C#.
Thanks,
Tyler