Copying content to a DOM Textarea element in c#
Greeting,
I sometimes have a problem with the code below. Sometimes it returns a strange error depending on the content I want to pass to the Textarea element of a webpage.
Code:
HtmlDocument DOC = this.webBrowser1.Document;
foreach (ListViewItem lvi in lvFieldsCopying.Items)
{
if (lvi.SubItems[2].Text != "")
{
HtmlElementCollection oHtmlElements = DOC.GetElementsByTagName("textarea");
foreach (HtmlElement textarea in oHtmlElements)
{
if (textarea.Name == lvi.SubItems[2].Text)
{
//MessageBox.Show(lvi.SubItems[1].Text);
try {
textarea.InnerHtml = lvi.SubItems[1].Text.ToString();
}
catch (Exception exp) {
MessageBox.Show("Could not copy your field to the site field: " + exp.Message);
}
}
}
}
}
Sometimes, depending on the content of the SubItem, exp.Message is "Exception from HRESULT: 0x800A0259".
Did someone run into this already?
Re: Copying content to a DOM Textarea element in c#
Hi, did you solve this problem?
I also have the same problem in my program, a little strange.
Can you give some suggestion? Thanks.