Sean

Sean

  • NA
  • 6
  • 0

Webbrowser and html input text without "post"

Jul 19 2007 6:24 AM
I have a webbrowser and a system.windows.forms.button (not an html button).
I want to read the text from input objects, like a basic textbox for a name, in an html document but without it having to be "post"ed.

here's an example of the html doc loaded into the browser

<html>
<body>
<form>
Name: <input name="name">
Address: <input name="address">
</form>
</body>
</html>

Notice there is no submit button on the form.

Someone would fill in their name and a line of their address then click a System.Windows.Forms.Button
Here is my code (which doesn't work as I expected it to)

foreach(HtmlElement elt in browser.Document.Forms)
{
foreach(HtmlElement ch in elt.GetElementsByTagName("INPUT"))
{
MessageBox.Show(ch.Name + " Text = " + ch.InnerText);}
}

I was expecting it would show the text that was typed in but I keep getting a blank return.

Any help would be great!

Thanks!
Sean Murphy
"All things great and small start at the same point, the first step."

Answers (1)