views:

25

answers:

0

I am trying to create a web crawl application to access the Chicago White Sox website and pull off the date of the next game. The application then goes to the 10 day forecast of the team's stadium and pulls the weather from there. I am wondering how to display just the forecast of the game, and not the full 10 day forecast. The pointers have the correct websites. Also, the date format for the whitesox was different from the date format of the weather.com, but I changed the string to make them the same, I think.

Thank You in advance for the help.

    Private Sub SoxButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SoxButton.Click
    wbBrowser.Visible = True
    wbBrowser.Navigate("http://chicago.whitesox.mlb.com/index.jsp?c_id=cws", Nothing, Nothing, Nothing, Nothing)
    Do
    Loop Until Not wbBrowser.Busy

    Dim HTMLDoc As mshtml.HTMLDocument
    Dim IHTMLEle As mshtml.IHTMLElement

    Dim GameDate As String = TextBox1.Text

    HTMLDoc = wbBrowser.Document

    Do
    Loop Until Not wbBrowser.Busy

    IHTMLEle = HTMLDoc.getElementById("m_next")

    Dim mystring As String

    mystring = IHTMLEle.innerText

    If Not IHTMLEle.innerText Is Nothing AndAlso mystring.Contains("Next Game:") Then
        TextBox1.Text = mystring
        TextBox1.Text = TextBox1.Text.Replace("4/", "Apr ")
        TextBox1.Text = TextBox1.Text.Replace("5/", "May ")
        GameDate = TextBox1.Text.Remove(0, 16)

        TextBox3.Text = GameDate
    End If
    wbBrowser.Navigate("http://www.weather.com/weather/tenday/36728:20", Nothing, Nothing, Nothing, Nothing)

    Do
    Loop Until Not wbBrowser.Busy

    HTMLDoc = wbBrowser.Document

    Do
    Loop Until Not wbBrowser.Busy

    IHTMLEle = HTMLDoc.getElementById("tenday")

    Dim forestring As String

    forestring = IHTMLEle.innerText
    forestring = forestring.IndexOf(GameDate)

    If Not IHTMLEle.innerText Is Nothing AndAlso forestring.Contains(TextBox1.Text.Remove(0, 16)) Then
        TextBox2.Text = forestring
    End If

    wbBrowser.Quit()
    wbBrowser = Nothing
End Sub

End Class