Sign in to follow this  
GameMasterXL

[.net] getting html form data with C#

Recommended Posts

GameMasterXL    100
I am trying currently to extract the data from my html textbox using a web control so i can save it but i am having no look at all. This is what i tried, string store = webbrowser1.document.getElementById("txt").innerText; that didn't do out at all.

Share this post


Link to post
Share on other sites
Justaddwater    100
Hello again heh

Its been awhile since I have done that, but I think this should work



foreach (mshtml.IHTMLElement wbrElm in HTMLDocument.all )
{
string strName;


if(wbrElm.tagName.ToLower() == "input" && wbrElm.outerHTML.IndexOf("name", 1) > 0)
{
strName = wbrElm.getAttribute("name", 0).ToString();



Share this post


Link to post
Share on other sites
Justaddwater    100
yeah, its different, the way Im doing it is putting the page into a webdoc and then parseing that as opposed to grabbing it right off the page like your trying to do. Im not saying it cant be done that way, just not a way i have done it in the past.

mshtml comes from adding a refernce to Microsft.mshtml

used for parseing that object.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this