1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

vb.net

Discussion in 'Visual Basic .NET' started by astradamasta, May 12, 2009.

  1. astradamasta

    astradamasta Registered Member

    Joined:
    Nov 24, 2008
    Messages:
    56
    Likes Received:
    8
    i am trying to extract some usernames from a website. normally i dont have a problem and but cant get it to work...here is the code i normally use

    For Each temp As HtmlElement In WebBrowser1.Document.Links
    Dim str As String = Nothing
    str = temp.GetAttribute("href")
    If str.Contains("profile") Then
    Dim x() As String
    x = str.Split("=")
    ListBox1.Items.Add(x(1))
    End If
    str = Nothing
    Next

    but this is the html code i want to get from

    <a href="http://help.com/?status=@astradamasta%20&in_reply_to_status

    how would i go about getting the user which is astradamasta

    thanks in advance
     
  2. spite42o

    spite42o Junior Member

    Joined:
    Jan 9, 2009
    Messages:
    183
    Likes Received:
    146
    Occupation:
    BHPimp
    Location:
    Your Moms House.
    heres some advice... drop vb.net learn c#.net ;) you'll be more happy... also look HtmlAgilityPack... it'll help you with wonders, or you could use Regex
     
  3. mshteam

    mshteam Registered Member

    Joined:
    Oct 1, 2008
    Messages:
    84
    Likes Received:
    35
    Regular expression is probably your best choice.
     
  4. wowmanwow

    wowmanwow Registered Member

    Joined:
    Nov 7, 2008
    Messages:
    60
    Likes Received:
    12
    Code:
    For Each temp As HtmlElement In WebBrowser1.Document.Links
    Dim str As String = Nothing
    str = temp.GetAttribute("href")
    If str.Contains("status=") Then
    Dim x() As String
    Dim y() As String
    x = str.Split("@")
    y=x(1).ToString.Split("%")
    ListBox1.Items.Add(y(0))
    End If
    str = Nothing
    Next
    I didn't test it yet, tell me if it works.