none
Search RRS feed

  • Question

  • How do i search is a website (raw) something to = textbox in form and like go down from what i was searching and go down like 2 times and take the word that have there and do something with that like messagebox or something
    Saturday, January 19, 2019 9:21 AM

All replies

  • Just divide the job up into small pieces.  Do you know how to fetch a web page into a string?  There are lots of sites that show examples of how to fetch a web page in C#.

    Once you have a string, then it's just regular string manipulation.  You can search a string using the normal C# string functions or regular expression functions, then find additional matches after your target match.

    In some cases, it can be easier to use an HTML parser to help you extract pieces from the web page, but for simple jobs that is overkill.

    What have you already tried?


    Tim Roberts | Driver MVP Emeritus | Providenza & Boekelheide, Inc.

    Saturday, January 19, 2019 11:18 PM
  • nothing...
    Sunday, January 20, 2019 4:41 PM
  • Well, we're here to provide advice, not to write your programs for you.  Here's a very basic Microsoft web page that says how to fetch a web page as a stream:

    https://docs.microsoft.com/en-us/dotnet/framework/network-programming/how-to-request-a-web-page-and-retrieve-the-results-as-a-stream

    https://docs.microsoft.com/en-us/dotnet/framework/network-programming/requesting-data

    You use Stream.Read to read the contents into a string.  Before you start that, you might want to do some experiments where you hard-code a string that looks kind of like a web page, and play with the string searching operations to make sure you know how they work.

    Once you have all of that, it's just a matter of plumbing it all together.


    Tim Roberts | Driver MVP Emeritus | Providenza & Boekelheide, Inc.

    Sunday, January 20, 2019 7:06 PM
  • Hi Ahron321,

    Thank you for posting here.

    For your question, you could click F12 to open the DevTools of the website. And Clikc the button to select the element in the page.

    And then you could try the code below to search something in the website.

    https://social.msdn.microsoft.com/Forums/en-US/88c65b68-dd8c-4af8-8d92-9dec9cff6578/can-anyone-help-me-how-to-fetch-this-web-site-data-?forum=csharpgeneral

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Proposed as answer by Stanly Fan Friday, February 1, 2019 7:38 AM
    Monday, January 21, 2019 5:19 AM
    Moderator