本文介绍了c#textarea插入问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网站,有一些我希望以编程方式填写的文本区域。

我在我的c#应用程序的webbrowser1控件中打开网站,我已经创建了一个函数Settext。这个功能对文本框很有效,但似乎没有文本区域,任何想法为什么?



SetText(namedetailsHello);但它不起作用。有什么想法吗?



I have a website, there are some text areas I want to fill programically.
I open the website in my webbrowser1 control in my c# application and I have made a function Settext. This function works really well with textboxes, but seems to fail with text areas, any ideas why?

SetText("name" "details" "Hello"); But it doesnt work. Any ideas?

<textarea name="details" id="details" cols="35" wrap="physical" rows="1"  önfocus="this.style.height='55px';" style="width: 300px; height: 55px;"></textarea>


SetText(string attribute, string attName, string value)
        {


            Skybound.Gecko.GeckoElementCollection tagsCollection = ((Skybound.Gecko.GeckoWebBrowser)(tabControl2.SelectedTab.Controls[0])).Document.GetElementsByTagName("textarea");

            foreach (Skybound.Gecko.GeckoElement currentTag in tagsCollection)
            {

               // MessageBox.Show(currentTag.GetAttribute(attribute));
                // If the attribute of the current tag has the name attName

                if (currentTag.GetAttribute(attribute).Equals(attName))
                {

                    // Then set its attribute "value".

                    currentTag.SetAttribute("value", value);

                    currentTag.Focus();
                }
            }



            //  SendKeys.Send("{ENTER}");

        }

推荐答案


这篇关于c#textarea插入问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 17:59