I just want to ask if its possible to get values from an HTML page and display it on datagridview. If so, please tell me how to do it. thank you.
-
[Visit this](https://www.dotnetperls.com/scraping-html) – M. Adeel Khalid Feb 07 '17 at 08:24
1 Answers
What you're referring to is Web Scraping (you might want to do some googling on your own now that you know the term).
Given that you're using the c# tag, I'll stick to the options given by the .net ecosystem.
Your options are as follows:
HtmlAgilityPack. I won't go into detail here, since your question has already been answered here. HtmlAgilityPack requires you to understand XPaths, but this is probably the best-supported option in the .NET world.
Your second option will be to use CsQuery. It's not supported anymore but the latest version should be good enough. Use CsQuery if you're unfamiliar with Xpaths, but well versed in CSS3 selectors - as CsQuery is a .NET port of JQuery.
Your third option (not recommended) would be to learn how to use Regex, pick the HTML as a string and start manipulating it. I would discourage you from doing that, since even though browsers can easily handle this, a lot of the pages on the Internet are actually not valid html. Your scraper will have a hard time working around this issue.
Given how broad your question is, it's hard to get into specifics. Please pick one of the options, and when you hit bumps along the way, feel free to ask a follow-up question here.