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