Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Is there a way to take the value of a string and pass that to a textbox within a web page while using the webbrowser control?

like image 208
user Avatar asked Dec 03 '25 00:12

user


2 Answers

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

try this

like image 196
Arsen Mkrtchyan Avatar answered Dec 05 '25 15:12

Arsen Mkrtchyan


You can do something like this:

String newValue = "Sample Text";
HtmlElement txt = WebBrowser1.Document.GetElementById("ElementIdOnHtmlPage");
txt.SetAttribute("value",newValue);
like image 21
jerjer Avatar answered Dec 05 '25 14:12

jerjer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!