Results 1 to 4 of 4

Thread: Find username in downloaded HTML

  1. #1

    Thread Starter
    Lively Member feneck's Avatar
    Join Date
    Mar 2007
    Location
    Australia, Queensland, Gympie
    Posts
    85

    Exclamation Find username in downloaded HTML

    OK. So what I am trying to do is this, its something basic, but i cant do it.

    I have a web browser, its invisible, it then logs on using the details in the options of the program, it then downloads the HTML into a textbox(multiline).

    There is a small line of code in the HTML that displays the users name, however depending on who logged in, the name can be different. I want to know, how do a search through this mass amount of text and only get the small text "Welcome, ****" (where **** = a name)


    I thought that maybe i could find out the position of the start of the "Welcome," then find the position of the "&nsb" after the users name, then subtract both numbers, and there is the number for the TextBox1.SelectionLength

    Please help me, i have this idea, but i am new to .net and i have no idea what to do
    Thank you

    REMEMBER TO RATE

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Find username in downloaded HTML

    Don't use hidden controls like that. If you want the source of a Web page then create a WebClient object and call its DownloadString method. Once you have the HTML source in a String you can manipulate it using methods of the String class, like Substring and IndexOf, or you can perform pattern matching using regular expressions. There would be numerous examples of using a Regex to find HTML tags already posted on the forum.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Lively Member feneck's Avatar
    Join Date
    Mar 2007
    Location
    Australia, Queensland, Gympie
    Posts
    85

    Re: Find username in downloaded HTML

    the only problem with this is that i need to log in?? how do i do that with a WebClient object? Can this be done?

    REMEMBER TO RATE

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Find username in downloaded HTML

    Have you read the documentation for the WebClient class? I'm guessing not. Do so and you'll have your answer.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width