C # - pass string to textbox in web page using webbrowser control

Is there a way to take a string value and pass it to a textbox on a web page when using the webbrowser control?

+2


source to share


3 answers


HtmlDocument doc = this.webBrowser1.Document;
doc.GetElementById("myId").SetAttribute("Value", "someValue");

      



try it

+8


source


You can do something like this:



String newValue = "Sample Text";
HtmlElement txt = WebBrowser1.Document.GetElementById("ElementIdOnHtmlPage");
txt.SetAttribute("value",newValue);

      

+1


source


You can do browser automation in C # to control WebBrowser.

Here's a link to an article explaining how you can do this.

http://www.codeproject.com/KB/cs/mshtml_automation.aspx

0


source







All Articles