Guest User

Untitled

a guest
Jul 18th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. htmlWeb hw = new HtmlWeb();
  2. if (txtCurrentURL.Text == "")
  3. {
  4.  
  5. MessageBox.Show(" Enter Web Address to Process ");
  6. }
  7. else
  8. {
  9. HtmlAgilityPack.HtmlDocument htmlDoc = hw.Load(@txtCurrentURL.Text);
  10. if (htmlDoc.DocumentNode != null)
  11. {
  12. try
  13. { foreach (HtmlNode text in htmlDoc.DocumentNode.SelectNodes(txtExpression.Text))
  14. {
  15. _items.Add(text.InnerHtml);
  16. richTextResults.Text = text.InnerHtml;
  17. } }
  18.  
  19. catch
  20. { MessageBox.Show(" No Usefull Data found");
  21. }
  22. lstBxResult.DataSource = _items;
  23. }
  24. }
  25.  
  26. private HtmlWeb CreateWebRequestObject()
  27. {
  28. HtmlWeb web = new HtmlWeb();
  29. web.UseCookies = true;
  30. web.PreRequest = new HtmlWeb.PreRequestHandler(PreRequestStuff);
  31. web.PostResponse = new HtmlWeb.PostResponseHandler(AfterResponseStuff);
  32. web.PreHandleDocument = new HtmlWeb.PreHandleDocumentHandler(PreHandleDocumentStuff);
  33. return web;
  34. }
Add Comment
Please, Sign In to add comment