I hope the title was clear enough, but I will try to explain...
I'm using C# Winforms ( dotnet 4.5 ).
The thing is that I'm creating a WebBrowser control and try to set the content with wb.DocumentText
. But when I try to loop through the elements, it says that the document is empty (null)
Here's my code:
WebBrowser wb = new WebBrowser();
wb.DocumentText = leMessage;
HtmlElementCollection elems = wb.Document.GetElementsByTagName("a");
foreach (HtmlElement elem in elems)
{
// Do Some Stuff
}
leMessage
holds an HTML newsletter message and there are some a tags in it.
I've already tried this: wb.Document.Body.InnerHtml = leMessage;
but that didn't work either...
What did I miss or do wrong?