CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1

    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?
    David Domingues at webrickco@gmail.com. Feel free to visit http://www.webrickco.com

  2. #2
    Join Date
    Mar 2013
    Posts
    1

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured