Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# .NETWebBrowser&;文本区_C#_Vb.net_Browser - Fatal编程技术网

C# .NETWebBrowser&;文本区

C# .NETWebBrowser&;文本区,c#,vb.net,browser,C#,Vb.net,Browser,我想在VB.NET/C#中的Webbrowser控件中写入数据 这是页面代码: 到目前为止,我已经尝试过:WebBrowser1.Document.GetElementById(“粘贴内容”).SetAttribute(“值”、“测试”) 但它不起作用…为此使用htmlelement HtmlElement textArea = webBrowser1.Document.All["paste_content"]; if (textArea != null) { textArea.InnerT

我想在VB.NET/C#中的Webbrowser控件中写入数据

这是页面代码:

到目前为止,我已经尝试过:
WebBrowser1.Document.GetElementById(“粘贴内容”).SetAttribute(“值”、“测试”)


但它不起作用…

为此使用htmlelement

HtmlElement textArea = webBrowser1.Document.All["paste_content"];
if (textArea != null)
{
  textArea.InnerText = "This is a test";
} 
我写了一个例子:(试试这个(用C#)

公共部分类表单1:表单
{
公共表格1()
{
初始化组件();
webBrowser1.DocumentCompleted+=新的WebBrowserDocumentCompletedEventHandler(webBrowser1\u DocumentCompleted);
}
私有void Form1\u加载(对象发送方、事件参数e)
{
webBrowser1.DocumentText=“”;
}
作废webBrowser1\u DocumentCompleted(对象发送者,WebBrowserDocumentCompletedEventArgs e)
{
webBrowser1.Document.GetElementById(“粘贴内容”).InnerText=“测试”;
}
}

我已将其转换为VB.NET并在documentcompleted事件下应用,但它不起作用。。。。这是网站顺便说一句:
 public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            webBrowser1.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser1_DocumentCompleted);
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            webBrowser1.DocumentText = "<html><body><textarea id=\"paste_content\" name=\"paste_content\"></textarea></body></html>";
        }

        void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            webBrowser1.Document.GetElementById("paste_content").InnerText = "test";
        }
    }