Click here to Skip to main content
15,880,392 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#

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:

C#
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
C#
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
Updated 30-Mar-13 18:29pm
v5
Comments
Sergey Alexandrovich Kryukov 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.

—SA
Lighter Joul 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900