Hi,

I guess this interesting small windows application just needs a httpwebrequest and webresponse object. We need to request a web address(which is a google search of football or cricket live - example shown in the screenshot) every 10 minutes using a timer and get the response with score or updates as highlighted and pop up to the user without interuppting his activities. Have attached the screenshot of how what the application would be doing. Can we do this.

Recommended Answers

All 7 Replies

Yes you can.:)

See if this thread helps with extracting data from a website. Should be easy to have the code use HTTP instead of a WebBrowser.

Hi All,

for the below text, I should have four items(there are four >scorecard<) added to my Checkedlistbox1
NZ 114/3(28.2) - LRPL Taylor* 23(27), SB Styris 16(23) | SL yet to bat
Aus 260/6(50.0) | Ind 261/5(47.4) (India won by 5 wickets)
WI 112/10(43.3) | Pak 113/0(20.5) (Pakistan won by 10 wickets)
Zim 308/6(50.0) | Ken 147/10(36.0) (Zimbabwe won by 161 runs)

sample httpwebresponse

" src="/images/icons/onebox/cricket-40.gif" border=0 style="margin-right:2px"></a><td valign=top width=100%><table border=0 cellpadding=0 cellspacing=0 style="margin:2px 0"><tr><td>NZ 114/3(28.2) - LRPL Taylor* 23(27), SB Styris 16(23) | SL yet to bat<a href="/url?q=http://scoren.willow.tv/Match/1940&amp;sa=X&amp;ei=LL2RTZWPM4-GvgOd58HxBw&amp;ved=0CC0Q5AEoADAA&amp;usg=AFQjCNGjJP-QopTZ-8bkiI4KTKtpUN7IwA">scorecard</a>&nbsp;<tr><td>Aus 260/6(50.0) | Ind 261/5(47.4) (India won by 5 wickets)<a href="/url?q=http://scoren.willow.tv/Match/1933&amp;sa=X&amp;ei=LL2RTZWPM4-GvgOd58HxBw&amp;ved=0CC8Q5AEoADAA&amp;usg=AFQjCNHTIIMwJZb8MCx4bDblDud2mQhKcw">scorecard</a>&nbsp;<tr><td>WI 112/10(43.3) | Pak 113/0(20.5) (Pakistan won by 10 wickets)<a href="/url?q=http://scoren.willow.tv/Match/1937&amp;sa=X&amp;ei=LL2RTZWPM4-GvgOd58HxBw&amp;ved=0CDEQ5AEoADAA&amp;usg=AFQjCNGpzrqGMn8xQNQLx6V5JYcC8_4w7A">scorecard</a>&nbsp;<tr><td>Zim 308/6(50.0) | Ken 147/10(36.0) (Zimbabwe won by 161 runs)<a href="/url?q=http://scoren.willow.tv/Match/1935&amp;sa=X&amp;ei=LL2RTZWPM4-GvgOd58HxBw&amp;ved=0CDMQ5AEoADAA&amp;usg=AFQjCNEuTnrd1DqHxZfCLssDxzctulbbEw">scorecard</a>&nbsp;<tr><td><span class=a>onebox.willow.tv</span><tr><td><a

My code.I reached till here. However in the list box I am getting some weirrd values :(

Imports System.Text.RegularExpressions
Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("http://www.google.co.in/search?hl=en&q=cricket+live+score&btnG=Search&aq=f&aqi=&aql=&oq=")
Dim response As System.Net.HttpWebResponse = request.GetResponse
Dim sr As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream())

Dim rssourcecode As String = sr.ReadToEnd
'Please help me in the below line
Dim r As New System.Text.RegularExpressions.Regex("<td>([^<]*)<a")
Dim matches As MatchCollection = r.Matches(rssourcecode)

For Each itemcode As Match In matches
'Please help me in the below line
CheckedListBox1.Items.Add(itemcode.Value.ElementAt(1))
Next
End Sub
End Class

See if this helps.

For Each itemcode As Match In matches
            With itemcode
                If .Value.Contains(")") Then '// make sure the .Value has data needed.
                    '// .Substring(4, .Value.Length - 6) = 4 for "<td>", -6 for "<td>" and the end of item for "<a".
                    CheckedListBox1.Items.Add(.Value.Substring(4, .Value.Length - 6))
                End If
            End With
        Next

Perfect, That helps

Now, what is the best way to pop up the contents of this CheckedListbox in our computer, without interupting the current process, we are doing.

I would probably use a Timer that runs that code on a different Thread every so often.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.