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
user
source
to share
3 answers
HtmlDocument doc = this.webBrowser1.Document;
doc.GetElementById("myId").SetAttribute("Value", "someValue");
try it
+8
Arsen Mkrtchyan
source
to share
You can do something like this:
String newValue = "Sample Text";
HtmlElement txt = WebBrowser1.Document.GetElementById("ElementIdOnHtmlPage");
txt.SetAttribute("value",newValue);
+1
jerjer
source
to share
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
this. __curious_geek
source
to share