Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/274.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# 在WebBrowser控件内设置TextArea的值时出错_C# - Fatal编程技术网

C# 在WebBrowser控件内设置TextArea的值时出错

C# 在WebBrowser控件内设置TextArea的值时出错,c#,C#,因此有以下文本区域: <textarea class="profile" name="message"></textarea> 我得到一个错误: Value of '0' is not valid for 'index'. 'index' should be between 0 and -1. Parameter name: index 如何设置此文本区域的值?当GetElementsByName()返回一个空的HtmlementCollection时会发生这种情况

因此有以下文本区域:

<textarea class="profile" name="message"></textarea>
我得到一个错误:

Value of '0' is not valid for 'index'. 'index' should be between 0 and -1.

Parameter name: index

如何设置此文本区域的值?

GetElementsByName()
返回一个空的
HtmlementCollection
时会发生这种情况。您确定此错误消息属于此代码吗?为什么不使用服务器控件并使用id直接设置值?(我猜代码来自一个网页。)@SLaks那么这是否意味着一个带有“message”名称的文本区域不存在?@SLaks:那么有没有办法将该值设置为找到的任何文本区域?@user1999321:查看前一行(并使用循环)你能给出一个例子@SLaks吗
Value of '0' is not valid for 'index'. 'index' should be between 0 and -1.

Parameter name: index