Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C#4.0
Hi every one, 
I made a winform application with C# 2010 Express. I used the webbrowser, and I plan to analyze one web page and update the content in that page.
However, I got the div element <textarea id="articleText"></textarea>, when I start to fill in that div, I got the 'HRESULT:0x800A0259 COMException' error.
I have no ideal about that error, could any one help me, thanks a lot...
Following is the error code:
HtmlElementCollection dhl = webbrowser1.Document.GetElementsByTagName("textarea");
for (int i = 0; i < dhl.Count; i++)
htmlElement item = dhl[i];
if (item.GetAttribute("id").Equals("articleText"))
    item.InnerHtml = "<font color='red'> Here is the content...</FONT><br><br>";  
The error happens on
item.InnerHtml = "<font color='red'> Here is the content...</FONT><br><br>"; 
However, if I changed the item.InnerHtml = "content", there is no error.
I'm very strange about the problem.
Posted 27-Mar-13 18:24pm
Edited 30-Mar-13 19:29pm
Sergey Alexandrovich Kryukov at 27-Mar-13 23:34pm
I'm not sure it can work, but, just in case, try HTML which is well-formed XML instead:
<font color="red"> Here is the content...</font><br/><br/>
Besides, stop using font element and such unstructured attribute. Instead, use spam and CSS. This is not related to your problem but important for proper HTML culture.
Lighter Joul at 29-Mar-13 2:31am
Thanks for your answer, but it does not work yet. I just make an example for the font element, there is also an error when I use "<a href="..">test</a>"

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Advertise | Privacy | Mobile
Web01 | 2.8.150327.1 | Last Updated 31 Mar 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100