开发者

Paste a text to textarea in browser control in Vb.Net

开发者 https://www.devze.com 2023-01-21 03:39 出处:网络
How can I paste a text to the text area within a form in the browser control?开发者_运维知识库

How can I paste a text to the text area within a form in the browser control?

开发者_运维知识库

I think how i have selected is correct

 browser1.Document.Forms.GetElementsByName("editform").GetElementsByName("input")

UPDATE:Here is the Html

....
<form name="editform">
<textarea name="input">
</textarea>
</form>
...


Here is an example of how it can be done based on the HTML you've provided. You must first add a reference to MSHTML via the Microsoft.mshtml. Also, I would recommed adding an id attribute to the text area then you can get to it much easier. Something along these lines.

<form name="editform"> 
    <textarea id="myTextArea" name="input"> 
    </textarea> 
</form>

Then you can set the value property of the text area.

Dim textArea As HTMLTextAreaElement

textArea = WebBrowser1.Document.GetElementById("myTextArea").DomElement
textArea.value = "Hello World!"


Figured out it's not possible due to security reasons.

0

精彩评论

暂无评论...
验证码 换一张
取 消