Jump to content
  • Advertisement
Sign in to follow this  
GameMasterXL

[.net] getting html form data with C#

This topic is 4759 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
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
would mshtml be the web control. In VB it would be variablenamehere = webbrowser1.document.all.getElementById("txt").value; i wish it was like that in C#.

Share this post


Link to post
Share on other sites
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!