Results 1 to 7 of 7

Thread: [2008] Getting The Data You Need from a website

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2008
    Posts
    62

    [2008] Getting The Data You Need from a website

    Using webcontrol i am able to transfer the html code to a textbox but i need the data of amount of refferals some of the text is

    # of Referrals (view)X

    X are the number of refferals of the person how can i get the value of X

    I tried the data split code but it didnt help
    Code:
    dim data as string = textbox1.text
    dim Split() as string = data.split(" "c)
    'bla bla but it didnt work
    I just wanted to ask is there any simpler and better way?

  2. #2
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: [2008] Getting The Data You Need from a website

    You need to study the text data and look for special patterns. Once you find a pattern, you can use regex to find matches to that pattern. However, if you just want to look for a value that follows right after the term "# of Referrals (view)", you can use string.indexof to find the start index of the term, and from there, you can extract what you need using string.substring function.
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

  3. #3

    Thread Starter
    Member
    Join Date
    Jul 2008
    Posts
    62

    Re: [2008] Getting The Data You Need from a website

    Quote Originally Posted by stanav
    You need to study the text data and look for special patterns. Once you find a pattern, you can use regex to find matches to that pattern. However, if you just want to look for a value that follows right after the term "# of Referrals (view)", you can use string.indexof to find the start index of the term, and from there, you can extract what you need using string.substring function.
    Can You Please Give An Example

  4. #4

    Thread Starter
    Member
    Join Date
    Jul 2008
    Posts
    62

    Re: [2008] Getting The Data You Need from a website

    Can i get some help here

  5. #5

    Thread Starter
    Member
    Join Date
    Jul 2008
    Posts
    62

    Re: [2008] Getting The Data You Need from a website

    vb Code:
    1. Dim C As String = "dfdh dhd dashd dfhsdif disdfh hisasf # of Referrals (view)25 asdsa dsa"
    2.         Dim A As String = C.IndexOf("# of Referrals (view)")
    3.         Dim retString As String
    4.         retString = C.Substring(21, 1)
    5.         MsgBox(retString)

    Tried this but it didnt work

  6. #6
    Lively Member
    Join Date
    Oct 2006
    Posts
    86

    Re: [2008] Getting The Data You Need from a website

    You aren't even using 'A' in that code...
    Visual Studio 2005 - Visual Basic and C#
    Love that SQL

  7. #7
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: [2008] Getting The Data You Need from a website

    Quote Originally Posted by Orbit__
    vb Code:
    1. Dim C As String = "dfdh dhd dashd dfhsdif disdfh hisasf # of Referrals (view)25 asdsa dsa"
    2.         Dim A As String = C.IndexOf("# of Referrals (view)")
    3.         Dim retString As String
    4.         retString = C.Substring(21, 1)
    5.         MsgBox(retString)

    Tried this but it didnt work
    You almost got it right.... It should be something like this:
    Code:
     Dim C As String = "dfdh dhd dashd dfhsdif disdfh hisasf # of Referrals (view)25 asdsa dsa"
            Dim searchTerm As String = "# of Referrals (view)"
            Dim numberOfCharactersToGet As Integer = 2
            Dim retString As String = String.Empty
            Dim index As Integer = C.IndexOf(searchTerm)
            If index >= 0 Then
                Try
                    retString = C.Substring(index + searchTerm.Length, numberOfCharactersToGet)
                Catch ex As Exception
                    MessageBox.Show(ex.Message)
                End Try
            End If
            MessageBox.Show(retString)
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

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