Search code examples
visual-studio-2013windows-phonewebbrowser-control

Fill a Form in the WebBrouser control using InvokeScript


I tried to fill a form in WebBrowser using InvokeScript. This code worked:

WebBrowser1.InvokeScript("eval", "document.getElementById('name').value = 'anyword'")

But when I tried to reference a textbox in the script, it didn't work:

WebBrowser1.InvokeScript("eval", "document.getElementById('name').value = textBox1.text")

How can I do this?


Solution

  • WebBrowser1.InvokeScript("eval", 
                             "document.getElementById('name').value = '" 
                             + textBox1.text + "'")