|
-
Jul 28th, 2008, 04:28 PM
#1
Thread Starter
Member
[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?
-
Jul 28th, 2008, 09:05 PM
#2
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 -
-
Jul 29th, 2008, 08:53 AM
#3
Thread Starter
Member
Re: [2008] Getting The Data You Need from a website
 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
-
Jul 29th, 2008, 10:51 AM
#4
Thread Starter
Member
Re: [2008] Getting The Data You Need from a website
-
Jul 29th, 2008, 11:11 AM
#5
Thread Starter
Member
Re: [2008] Getting The Data You Need from a website
vb Code:
Dim C As String = "dfdh dhd dashd dfhsdif disdfh hisasf # of Referrals (view)25 asdsa dsa"
Dim A As String = C.IndexOf("# of Referrals (view)")
Dim retString As String
retString = C.Substring(21, 1)
MsgBox(retString)
Tried this but it didnt work
-
Jul 29th, 2008, 11:51 AM
#6
Lively Member
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
-
Jul 29th, 2008, 01:43 PM
#7
Re: [2008] Getting The Data You Need from a website
 Originally Posted by Orbit__
vb Code:
Dim C As String = "dfdh dhd dashd dfhsdif disdfh hisasf # of Referrals (view)25 asdsa dsa"
Dim A As String = C.IndexOf("# of Referrals (view)")
Dim retString As String
retString = C.Substring(21, 1)
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|