1. Do i need to read the data as HTML code ?
2. Is that the only way of reading content from website ?
If yes :
Which is the way to split the "strings" ?
Is only way to split string using IndexOf ?
If no:
Which other way i need to look for ?
Re: Read the data from website and sort in datagridview
1. Do i need to read the data as HTML code ?
2. Is that the only way of reading content from website ?
If yes :
Which is the way to split the "strings" ?
Is only way to split string using IndexOf ?
If no:
Which other way i need to look for ?
Hi, for reading data from website, you may look into WebClient or WebRequest classes from MSDN. They return the page source as HTML string. The data provided in your image is a table element. So, it's not difficult to read the contents. For splitting strings, you may use the string function Split(). Otherwise, for complex patterns, Regex is an option.
If the website has a webservice or wcf where in you can obtain the information as XML or JSON, then that might be an option too.
Re: Read the data from website and sort in datagridview
Thank you for your answer. I used the webclient to read the html source as string. Shown that string in textbox using this line
Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim sourceString As String = New System.Net.WebClient().DownloadString("http://www.livescore.com/soccer/england/premier-league/")
TextBox1.Text = sourceString
End Sub
Re: Read the data from website and sort in datagridview
You can loop through the source and extract those values inside the td using substring or similar string functions. After you have retrieved those values/scores, put them in a List or DataTable object and then set the DataSource property of the DataGridView control with your List or DataTable.