Click here to Skip to main content
15,885,366 members
Articles / Desktop Programming / Win32

A Full Yahoo! Weather App, Yes Another One

Rate me:
Please Sign up or sign in to vote.
4.96/5 (29 votes)
16 Apr 2011CPOL8 min read 244.4K   3.9K   110   124
Uses Farhad Siasar's YahooWeathertlb library with a few added functions
Weather Desktop

WeatherDesktop.jpg

Weather Desktop Splash Screen

WeatherDesktopSplash.jpg

Introduction

This is a full weather application complete with 2-Day and 5-Day forecasts. It displays the local weather and 4 maps (Radar, IR Satellite, HeatIndex and WindChill). The application has panel animation (thanks to Fredrik Bornander) that imitates CloneDVD2's sliding frames and I also added some taskbar buttons using the WindowsAPICodePack. I added a folder in the Debug folder called "states". In this folder are the 50 states' text files that contain all the cities, towns, villages, and townships. I also added a zipcode and woeID file. WoeID stands for "Where on Earth ID". The WoeID combobox is in sync with the zipcode combobox. I added these so you wouldn't have to go searching through Yahoo to find your WoeID. The WoeID is used to retrieve the 5-day forecast only. I used horizontal bar styles to display the temperature, wind velocity and wind direction using Steve Lows "NextUI library". A splashscreen was also added because the weather app takes a while to boot up. There is also a Daffy Duck Cursor that I use quite a bit for all my applications.

This weather app uses a re-write of Farhad Siasar's YahooWeathertlb and is now called "pWeatherLib.dll". The library is a bit larger than the original because of the way it was designed.

Panel Animation

I had to come up with a solution to move the panels (Left-to-Right and Right-to-Left) so I asked a question in the VB forum and Fredrik Bornander came up with a solution that worked very well. I had to change some of his code to work with this app, but all-in-all, it's still his Idea. Thanks Fredrik.

To get started with the animation, I first added 5 panels to the form. I placed 4 of them off the screen so that they could not be seen. I placed them in sequential order when scrolling (forward and backwards). To do the scrolling, first we must add the panels to a List, set the panels locations, then we use a timer with a couple of button click events. In the next 4 code blocks below are the subs for the animation.

VB.NET
Private Sub frmWeatherDesktop_Load_
(sender As Object, e As System.EventArgs) Handles Me.Load

        'Panel Animation setup
        panels.Add(pnlLocalWeather)
        pnlLocalWeather.Location = New Point(0, 0)
        panels.Add(pnlTwoDayForecast)
        pnlTwoDayForecast.Location = New Point(816, 0)
        panels.Add(pnlFiveDayForecast)
        pnlFiveDayForecast.Location = New Point(1632, 0)
        panels.Add(pnlMaps)
        pnlMaps.Location = New Point(2448, 0)
        panels.Add(pnlAbout)
        pnlAbout.Location = New Point(3264, 0)

        For Each panel As Panel In panels
            Controls.Add(panel)
        Next

        animationTimer.Interval = 50
        animationTimer.Start()

		'...more code follows.
	End Sub

The panel sizes are 814x561. As you can see in the code above, I spaced the panels 2 pixels apart from each other by adding 2 to the panels width location. Next we add them to a Controls array and set and start the timer.

VB.NET
Private Sub animationTimer_Tick_
(sender As Object, e As System.EventArgs) Handles animationTimer.Tick
        If panels(currentIndex).Location.X <> 0 Then
            Dim delta As Integer = panels(currentIndex).Location.X / 5.0
            For Each panel As Panel In panels
                panel.Location = New Point(panel.Location.X - delta, panel.Location.Y)
            Next
        End If
    End Sub

When scrolling using the "Previous and Next" buttons, we check the currentIndex to see where we are at. If we are at the beginning and press the "Previous Button" we do not want a run-time error popping up on us, so we just exit the sub gracefully and the same for the "Next Button" if we are at the last panel, we do the same, exit with grace.

VB.NET
Private Sub btnPrevious_Click(sender As Object, e As System.EventArgs) _
	Handles btnPrevious.Click
        If currentIndex = 0 Then
            Exit Sub
        Else
            currentIndex = Math.Max(0, currentIndex - 1)
        End If
    End Sub
VB.NET
Private Sub btnNext_Click(sender As Object, e As System.EventArgs) Handles btnNext.Click
        If currentIndex = 4 Then
            Exit Sub
        Else
            currentIndex = Math.Min(panels.Count - 1, currentIndex + 1)
        End If
    End Sub

Starting the Application

When the app is first started, there is a splashscreen as an introduction that displays a cartoon weather pic along with the Version numbers and what it does before the main form displays. While we are waiting, it is building the gauges, loading the zip codes and WoeID's in their respective combo boxes. To get the zipcode combobox and the WoeID combo box to sync with each other, we just set the WoeID combo box's selected index equal to the zipcode combo box's selected index into the zipcode' combobox's SelectedIndexChanged event.

VB.NET
Private Sub cmbZip_SelectedIndexChanged(sender As Object, e As System.EventArgs) _
	Handles cmbZip.SelectedIndexChanged
        cmbWoeID.SelectedIndex = cmbZip.SelectedIndex
    End Sub

Searching the ComboBoxes or Pull Your Hair Out

Because of the extensive amount of data that is loaded into the combo boxes, we need to add a auto-complete to the combo boxes. To do this, you must set the combo boxes DropDownStyle property to "DropDown". This will let you type in the combo boxes. Then set the AutoCompleteMode to "Suggest" and the AutoCompleteSource to "CustomSource" and that's all. To fill up the custom sources, we just fill them up when filling the combo boxes with their data. The code is below.

WDauto_complete.jpg

VB.NET
Private Sub OpentextFile(ByVal fname As String)

        Dim fs As FileStream
        Dim sr As StreamReader
        Dim strFile As String

        Try
            Dim strParts() As String
            fs = New FileStream(fname, FileMode.Open, FileAccess.Read)
            sr = New StreamReader(fs)
            strFile = sr.ReadLine()

            Do Until strFile Is Nothing
                strParts = Split(strFile, ",")
                cmbZip.Items.Add(strParts(0))
                cmbZip.AutoCompleteCustomSource.Add(strParts(0))
                cmbWoeID.Items.Add(strParts(1))
                strFile = sr.ReadLine()
            Loop

            fs.Close()

        Catch ex As Exception

            MessageBox.Show(ex.Message)

        End Try

    End Sub

We do the same thing for the states combo box and the cities combo box. We don't need to fool around with the WoeID combo box as it is synced to the zipcode combo box.

The GetCondition function takes a String as a value and passes back that same String. First, we have to get the enum code from the pWeatherLib library which is 0 through 47 and 3200. 0 is for Tornado, we have to use the same picture for 0 and 1, then each number matches up with the picture number. Below is the code I used for this routine.

VB.NET
Private Function GetCondition(ByVal strCondition As String) As String
    'Code by RSPercy 07/10/09
    Dim p As New pWeatherLib.pWeatherForecast(cmbZip.Text, temperatureUnit.Fahrenheit)
    Select Case t.rss.channel.item.condition.codeEnum
        Case 0
            strCondition = "Tornado"
            pb1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/1d.png"
        Case 1
            strCondition = "Tropical Storm"
            pb1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/1d.png"
        Case 2
            strCondition = "Hurricane"
            pb1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/2d.png"
        Case 3
            strCondition = "Severe Thunderstorms"
            pb1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/3d.png"
        Case 4
            strCondition = "Thunderstorms"
            pb1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/4d.png"
        Case 5
            strCondition = "Mixed Rain and Snow"
            pb1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/5d.png"
        Case 6
            strCondition = "Mixed Rain and Sleet"
            pb1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/6d.png"
        Case 7
        ...
        ...
        ...
        Case 46
            strCondition = "Snow Showers" 'Night
            pb1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/46d.png"
        Case 47
            strCondition = "Isolated Thundershowers" 'Night
            pb1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/47d.png"
        Case 3200
            strCondition = "Not Available"
            pb1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/44d.png"
    End Select
    Return strCondition
End Function

Is it HOT Out or is it Me?

Updated the RetreiveHeatIndex function. This uses the air temperature (AT) and the relative humidity (RH) that we get from the Yahoo! Weather RSS Feed. The routine for this is available at Wikipedia. There is a short and a long routine. I used the long routine as it is more precise. This routine works best if the temperature is above 80 degrees and the humidity is above 40 degrees. If these conditions are not met, it displays a heat index temperature that is lower than the air temperature. So, I added a couple of If-Then-End If statements to correct this problem. Here is the code for this:

VB.NET
Private Function RetrieveHeatIndex(ByVal h As Long) As String
    'Code by RSPercy 03/25/2011
        'This is the more advanced version

        Dim p As New pWeatherLib.pWeatherForecast(cmbZip.Text, temperatureUnit.Fahrenheit)

        Dim HEATINDEX As Long

        'Heat Index Should be calculated only when air temperatures
        'are greater than 80°F (27°C), dew point temperatures are
        'greater than 60°F (16°C), and relative humidities are higher than 40%.
        HEATINDEX = Math.Round(C1 + (C2 * AT) + (C3 * RH) - _
		(C4 * AT * RH) + (C5 * (AT ^ 2)) + (C6 * (RH ^ 2)) + _
               	(C7 * (AT ^ 2) * RH) - (C8 * AT * (RH ^ 2)) + _
		(C9 * (AT ^ 2) * (RH ^ 2)) - (C10 * (AT ^ 3)) + _
               	(C11 * (RH ^ 3)) + (C12 * (AT ^ 3) * RH) + _
		(C13 * AT * (RH ^ 3)) - (C14 * (AT ^ 3) * (RH ^ 2)) + _
               	(C15 * (AT ^ 2) * (RH ^ 3)) - (C16 * (AT ^ 3) * (RH ^ 3)))

        If (AT > 80) And (GetDewPoint(RH) > 60) And (RH > 40) Then
            h = HEATINDEX
        Else
            h = AT
        End If

        'Wind Chill Should only be calculated when temperatures
        'are at or below 50°F and wind speeds are above 3 MPH. Bright
        'sunshine may increase the wind chill temperature by 10°F to 18°F.
        If AT <= 50 And p.rss.channel.wind.speed > 3 Then
            h = p.rss.channel.wind.chill
        Else
            h = AT
        End If

        Return h
End Function

Updated the btnGo_Click event. I had to rework the dew point to work correctly with the program. Now it gives the correct results. The GetDewPoint() function is called here, and is displayed below the btnGo_Click() event.

Using the Code

VB.NET
Private Sub btnGo_Click(ByVal sender As System.Object, _
        ByVal e As System.EventArgs) Handles btnGo.Click
    'Code by RSPercy 03/25/2011

        Try
            Dim p As New pWeatherLib.pWeatherForecast_
		(cmbZip.Text, temperatureUnit.Fahrenheit)      'p = all the goodies

            'Fill the main form with weather data.
            lblLatitude.Text = p.rss.channel.item.lat.ToString
            lblLongitude.Text = p.rss.channel.item.long.ToString

            lblLocation.Text = p.rss.channel.item.title               'Display the Title

            lblHigh.Text = p.rss.channel.item.forecast.high & "°"     'High temperature
            lblLow.Text = p.rss.channel.item.forecast.low & "°"       'Low temperature

            newWindD = p.rss.channel.wind.direction
            newWindS = p.rss.channel.wind.speed

            If newWindS = 0 Then
                lblWindVelocity.Text = "Wind Velocity is Calm."
            End If

            newTemp = p.rss.channel.item.condition.temp              'Current temperature
            AT = newTemp                           'A variable used in RetrieveHeatIndex

            lblCondition.Text = GetCondition(strMyString)  'Current Weather Condition

            lblHumidity.Text = p.rss.channel.atmosphere.humidity  'Humidity percentage
            RH = CInt(lblHumidity.Text)            'A variable used in RetrieveHeatIndex

            lblHeatIndexWindChill.Text = RetrieveHeatIndex(HI) & "°"  'Heat Index

            lblSunrise.Text = p.rss.channel.astronomy.sunrise    'Sunrise
            lblSunset.Text = p.rss.channel.astronomy.sunset      'Sunset

            lblVisibility.Text = p.rss.channel.atmosphere.visibility & " mi."  'Visibility

            If p.rss.channel.atmosphere.rising = 0 Then
                lblPressure.Text = p.rss.channel.atmosphere.pressure & "   " & _
                                   "in''  and  steady"
            ElseIf p.rss.channel.atmosphere.rising = 1 Then
                lblPressure.Text = p.rss.channel.atmosphere.pressure & "   " & _
                                   "in''  and  rising"
            ElseIf p.rss.channel.atmosphere.rising = 2 Then
                lblPressure.Text = p.rss.channel.atmosphere.pressure & "   " & _
                                   "in''  and  falling"
            End If

            lblDewPoint.Text = GetDewPoint(RH).ToString() & "°"

            RetrieveZipCode() 'Gets the zip-code and displays the correct doppler maps

            lblHumidity.Text += "%"
            lblTemperature.Text = newTemp.ToString & "°"
            lblTodaysDate.Text = FormatDateTime(Now.Date, DateFormat.ShortDate)

            WDTimer.Enabled = True
            WVTimer.Enabled = True
            TMPTimer.Enabled = True

            Me.Text = "Your Local Weather - " & p.rss.channel.title.ToString()
            'MessageBox.Show(t.rss.channel.item.guid)

            'Fill the 2-day forecast with data
            Get2DayForecast()

            'Do the same for the 5-day forecast.
            GetFiveDayInfo()

            'Display the About information.
            GetAboutInfo()

        Catch ex As System.NullReferenceException
            MessageBox.Show("Please Enter a Valid Zip-Code.", "Info to the Rescue")
            cmbZip.Focus()
        Catch 'exs As IOException
            MessageBox.Show("Please Try Again Later. Weather is Not Available.", _
		"Info to the Rescue")
            cmbZip.Focus()
        End Try
End Sub

Private Function GetDewPoint(ByVal intRH As Integer) As Integer
    'Code by RSPercy 03/25/2011
        Dim dewpoint As Integer

        Select Case intRH
            Case 40 To 43
                dewpoint = AT - 18
            Case 44 To 46
                dewpoint = AT - 17
            Case 47 To 49
                dewpoint = AT - 16
            Case 50 To 52
                dewpoint = AT - 15
            Case 53 To 55
                dewpoint = AT - 14
            Case 56 To 59
                dewpoint = AT - 13
            Case 60 To 63
                dewpoint = AT - 12
            Case 64 To 66
                dewpoint = AT - 11
            Case 67 To 69
                dewpoint = AT - 10
            Case 70 To 72
                dewpoint = AT - 9
            Case 73 To 76
                dewpoint = AT - 8
            Case 77 To 79
                dewpoint = AT - 7
            Case 80 To 82
                dewpoint = AT - 6
            Case 83 To 85
                dewpoint = AT - 5
            Case 86 To 89
                dewpoint = AT - 4
            Case 90 To 93
                dewpoint = AT - 3
            Case 94 To 96
                dewpoint = AT - 2
            Case 97 To 99
                dewpoint = AT - 1
            Case 100
                dewpoint = AT
            Case Else
                dewpoint = Math.Round(AT - ((100 - RH) / 5))
        End Select

        Return dewpoint
End Function

The GetWind function was removed and replaced with three CreateGauge subs. CreateTempGuage (code below), CreateWindDirectionGuage, and CreateWindSpeedGuage were added. The gauges have timer animation along with LED display. See the picture above. Here is my code for the compasses:

Compass Code

VB.NET
Private Sub CreateTempGauge()
        'Code by RSPercy 02/25/2010
        Dim hfTemp As HorizontalFrame = New HorizontalFrame(New Rectangle(1, 1, 912, 50))
        Me.BaseUI1.Frame.Add(hfTemp)
        hfTemp.BackRenderer.CenterColor = Color.DarkRed
        hfTemp.BackRenderer.EndColor = Color.Black

        Dim bar1 As New HorizontalScaleBar(hfTemp)
        bar1.StartValue = -60
        bar1.EndValue = 120
        bar1.MajorTickNumber = 19
        bar1.MinorTicknumber = 1
        bar1.CustomLabel = New String() {"-60", "-50", "-40", "-30", "-20", _
                                         "-10", "0", "10", "20", "30", _
                                         "40", "50", "60", "70", "80", _
                                         "90", "100", "110", "120"}
        bar1.TickMajor.Width = 3
        bar1.TickMajor.Height = 12
        bar1.TickMajor.FillColor = Color.Lime
        bar1.TickMajor.Type = TickBase.TickType.RoundedRect
        bar1.TickMinor.Width = 3
        bar1.TickMinor.Height = 8
        bar1.TickMinor.FillColor = Color.Lime
        bar1.TickMinor.TickPosition = TickBase.Position.Cross
        bar1.TickMinor.Type = TickBase.TickType.RoundedRect
        bar1.FillColor = Color.DarkBlue
        bar1.TickLabel.FontColor = Color.White
        bar1.TickLabel.LabelFont = New Font("Elephant", 8, FontStyle.Regular)

        hfTemp.ScaleCollection.Add(bar1)

        Dim pointer As HorizontalPointer = New HorizontalPointer(hfTemp)
        bar1.Pointer.Add(pointer)
        bar1.Pointer(0).BasePointer.PointerShapeType = Pointerbase.PointerType.Type1
        bar1.Pointer(0).BasePointer.FillColor = Color.Blue
        bar1.Pointer(0).BasePointer.Length = 15
    End Sub

Timer Events

VB.NET
Private Sub TMPTimer_Tick(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles TMPTimer.Tick

        If oldTemp < newTemp Then
            oldTemp += 1
            DirectCast((Me.BaseUI1.Frame(0)), _
		HorizontalFrame).ScaleCollection(0).Pointer(0).Value = oldTemp
            lblTemperature.Text = "Temperature " & oldTemp.ToString() & "°"
            If oldTemp = newTemp Then
                oldTemp = newTemp
                TMPTimer.Enabled = False
            End If
        End If

        If oldTemp > newTemp Then
            oldTemp -= 1
            DirectCast((Me.BaseUI1.Frame(0)), _
		HorizontalFrame).ScaleCollection(0).Pointer(0).Value = oldTemp
            lblTemperature.Text = "Temperature " & oldTemp.ToString() & "°"
            If oldTemp = newTemp Then
                oldTemp = newTemp
                TMPTimer.Enabled = False
            End If
        End If
End Sub

The TMPTimer_Tick event above is for the temperature gauge animation. When the app is first started, oldTemp is equal to zero and newTemp is equal to the temperature we get from the Yahoo! RSS Feed. When the timer gets activated, the code above is pretty much self-explanatory. If oldTemp is less than newTemp, then we add 1 to the digital display and the pointer value and display it to the user; if greater than, then we subtract one and do the displaying. The other two timer tick events are the same except for the variables.

When designing the compass, I had problems getting the "N" to line-up with the center top. I played around with the StartAngle and the SweepAngle till I got it right. I also had to do the same for bar2 (wind speed). You will need the NextUI library which can be found here, and the FunkyLibrary can be found here. All the compasses are pretty much the same.

Two Day Forecast

At first, I had no idea on how to extract a few items that I needed from an HTML document, so I decided to use Regex strings. The next thing was learning how to do this. I copied the 30 minute Regex tutorial and printed it out. It is included in the zip file. Next, you will need expresso. This is a very handy tool for learning regex strings.

I used a Regex string for this sub. I used the pipe operator to retrieve the six different condition types. There is probably a more complex string, but as I am a noob in this area, I used what worked for me.

VB.NET
Private Sub Get2DayForecast()
    'Code by RSPercy 03/25/2011
        Try

            lblDate1.Text = FormatDateTime(Now.Date, DateFormat.ShortDate).ToString()
            lblDate2.Text = FormatDateTime(DateAdd(DateInterval.Day, 1, Now.Date))

            Dim parts() As String
            Dim m As Match
            Dim strMatch As String = String.Empty
            Dim p As New pWeatherLib.pWeatherForecast_
		(cmbZip.Text, temperatureUnit.Fahrenheit)

            '''''''''''''''''''''''''''Day,    Condition,       High,           Low
            Dim pattern As String = _
		"\w*\s-\s(\w*|\w*\s\w*|\w*\s\w*\s\w*|\w*\s\w*\s\w*\s\w*|\w*\/\w*" &
                	"|\w*\/\w*\/\w*|\w*\s\w*\/\w*\s\w*|\w*\s\w*\/\w*|\w*\s\w*\/\w*\-\w*)_
		\.\s\w*:\s(\d{1,3}" &
                	"|\-\d{1,3})\s\w*:\s(\d{1,3}|\-\d{1,3})"

            Dim input As String = p.rss.channel.item.description

            For Each m In Regex.Matches(input, pattern, RegexOptions.Multiline)
                strMatch = m.Value

                If strMatch = Nothing Then
                    Exit For
                Else
                    strMatch = strMatch.Replace(" - ", ",")
                    strMatch = strMatch.Replace(". High: ", ",")
                    strMatch = strMatch.Replace(" Low: ", ",")
                    'MessageBox.Show(strMatch) 'For testing ONLY
                    parts = Split(strMatch, ",")
                    If parts(0) <> p.rss.channel.item.forecast.day Then
                        lblTomorrow.Text = parts(0)
                        lblcc2.Text = parts(1)
                        RetrieveForecastCode()
                        lblHi2.Text = "High: " & parts(2)
                        lblLo2.Text = "Low : " & parts(3)
                    ElseIf parts(0) = p.rss.channel.item.forecast.day Then
                        lblcc1.Text = parts(1)
                        RetrieveForecast1()
                        lblHi1.Text = "High: " & parts(2)
                        lblLo1.Text = "Low : " & parts(3)
                    End If
                End If
            Next

        Catch ex As Exception
            MessageBox.Show("Sorry...Try again later!", "Info to the Rescue!")
        End Try
End Sub

The only thing that differs is the conditions in the pattern string. In the subs in the paragraph below is where you will find the six different patterns:

  • Tornado
  • Severe Thunderstorms
  • Light Snow Showers
  • Mixed Rain and Snow
  • Rain/Thunder
  • AM Clouds/PM Sun

The list contains the 14 different patterns that I have came across so far. I have asked all over how to get one regex string to do the work of six different strings. After a lot of trial and error, I finally got it. I used the pipe operator to do this. I got rid of 189 lines of code.

The RetrieveForecastCode() and RetrieveForecast1() subs get the correct JPG files from the YahooWeatherPics folder and they are displayed in the correct PictureBoxes.

5-Day Forecast?...Weather Changes Everyday

This is by far the hardest thing I have had to do to this app. I had to learn how to request information from the Yahoo! server, switch data from one control to another for editing, and pass it back to the original control for use again; then I had to add a few regex strings for the 5-days, 5-conditions, 5-highs, 5-lows, 5-images, and 5-dates. Because there are six different types of strings that Yahoo! uses, I had to come up with a way to get and display these strings. I used a regex string to get all the strings that I needed. The results from this can be seen in the last picture above. This was all done in one sub (GetFiveDayInfo()). There is way too much code to display, so I will only display how to access the Yahoo! server for the page source code. Once we have the requested HTML page source code, we can start to take it apart and display the info that we need. This code in the previous app was removed as I stated earlier.

WDfiveDay.jpg

VB.NET
Private Sub GetFiveDayInfo()
        'Code by RSPercy 03/25/2011
        Try
            Dim parts() As String
            Dim parts1() As String
            Dim parts2() As String

            Dim m As Match
            Dim strMatch As String = String.Empty

            'Finds the 5-day forecast conditions...EX: Partly Cloudy, Rain/Thunder....etc.
            'There are 14 different patterns that we need.
            Dim patternAA As String = "<[\w]*/>{1}_
            ([\w\s/-]*|[\w\s/]*-{1}[der]{1,2})</div>"

            'Finds the days oy the week....EX: Mon, Tue, Wed, Thur, Fri, Sat, Sun.
            Dim pattern5Day As String = "\<\w*\>\w*\<\/\w*\>\<_
            \w*\>\w*\<\/\w*\>\<\w*\>\w*\<\/\w*\>\<_
            \w*\>\w*\<\/\w*\>\<\w*\>\w*\<\/\w*\>"

            'Finds the 5-day forecast Hi's and Low's
            Dim patternHiLow As String = "\<\w*\>\w*\:\s(\d{1,3}|\-\d{1,3})_
            \&\#\d{1,3}\;\s\<\w*\>\w*\:\s(\d{1,3}|\-\d{1,3})"


            'Create a request using a URL that can receive a post.
            Dim request As WebRequest = WebRequest.Create_
            ("http://weather.yahoo.com/united-states/" & cmbStates.Text _
            & "/" & cmbCity.Text & "-" & cmbWoeID.Text & "/")

            'Create POST data and convert it to a byte array.
            request.Method = "POST"
            Dim postData As String = "This is a test."

            ' Set the ContentType property of the WebRequest.
            Dim byteArray As Byte() = Encoding.UTF8.GetBytes(postData)

            ' Set the ContentType property of the WebRequest.
            request.ContentType = "application/x-www-form-urlencoded"

            ' Set the ContentLength property of the WebRequest.
            request.ContentLength = byteArray.Length

            'Create datastream and a response stream.
            Dim dataStream As Stream = request.GetRequestStream()

            ' Write the data to the request stream, then close it
            dataStream.Write(byteArray, 0, byteArray.Length)
            dataStream.Close()

            ' Get the response.
            Dim response As WebResponse = request.GetResponse()

            ' Get the status.
            Dim myString As String = CType(response, HttpWebResponse).StatusDescription

            ' Get the stream containing content returned by the server.
            dataStream = response.GetResponseStream()

            ' Open the stream using a StreamReader for easy access.
            Dim sr As StreamReader = New StreamReader(dataStream)

            ' Put the content in a textbox.
            Dim myTB As TextBox = New TextBox
            myTB.Multiline = True
            myTB.WordWrap = False
            myTB.Text = sr.ReadToEnd

            ' Clean up the streams.
            sr.Close()
            dataStream.Close()
            response.Close()

            'Move the content to a string variable.
            strMatch = myTB.Text

            'Remove the carriage returns and line feeds 
	   'so our regex patterns work correctly.
            strMatch = strMatch.Replace(ControlChars.CrLf, "")
            strMatch = strMatch.Replace(ControlChars.Cr, "")
            strMatch = strMatch.Replace(ControlChars.Lf, "")

            'Reset the textbox to nothing.
            myTB.Text = ""

            'populate the textbox with the new data
            myTB.Text = strMatch

            'Reset strMatch to nothing.
            strMatch = String.Empty

            'Get the Dates for the forecasts
            GetFiveDates()

            'Get the days of the week.
            For Each m In Regex.Matches(myTB.Text, pattern5Day, RegexOptions.Multiline)
                strMatch = m.Value

                If strMatch = Nothing Then
                    Exit For
                Else
                    strMatch = strMatch.Replace("<th>", "")
                    strMatch = strMatch.Replace("</th>", ",")
                    'MessageBox.Show(strMatch) 'For testing ONLY
                    parts = Split(strMatch, ",")
                    If parts(0) = "Today" Then
                        lblDay1.Text = parts(0)
                        lblDay2.Text = parts(1)
                        lblDay3.Text = parts(2)
                        lblDay4.Text = parts(3)
                        lblDay5.Text = parts(4)
                    ElseIf parts(0) = "Tonight" Then
                        lblDay1.Text = parts(0)
                        lblDay2.Text = parts(1)
                        lblDay3.Text = parts(2)
                        lblDay4.Text = parts(3)
                        lblDay5.Text = parts(4)
                    End If
                End If
            Next

            strMatch = String.Empty

            'Get the Highs and Lows.
            For Each m In Regex.Matches(myTB.Text, patternHiLow, RegexOptions.Multiline)
                strMatch += m.Value
            Next

            strMatch = strMatch.Replace("<td>High: ", ",")
            strMatch = strMatch.Replace("° <div>Low: ", ",")
            'MessageBox.Show(strMatch) 'For testing ONLY

            parts1 = Split(strMatch, ",")

            lblHigh1.Text = "High : " & parts1(1)
            lblLow1.Text = "Low  : " & parts1(2)
            lblHigh2.Text = "High : " & parts1(3)
            lblLow2.Text = "Low  : " & parts1(4)
            lblHigh3.Text = "High : " & parts1(5)
            lblLow3.Text = "Low  : " & parts1(6)
            lblHigh4.Text = "High : " & parts1(7)
            lblLow4.Text = "Low  : " & parts1(8)
            lblHigh5.Text = "High : " & parts1(9)
            lblLow5.Text = "Low  : " & parts1(10)

            strMatch = String.Empty

            'Get the five conditions and the Images that we need.
            For Each m In Regex.Matches(myTB.Text, patternAA, RegexOptions.Multiline)
                strMatch += m.Value
            Next
            strMatch = strMatch.Replace("<br/>", "")
            strMatch = strMatch.Replace("</div>", ",")

            'MessageBox.Show(strMatch)  'For testing ONLY
            parts2 = Split(strMatch, ",")

            lblCon1.Text = parts2(0)
            RetrieveForecastA()
            lblCon2.Text = parts2(1)
            RetrieveForecastB()
            lblCon3.Text = parts2(2)
            RetrieveForecastC()
            lblCon4.Text = parts2(3)
            RetrieveForecastD()
            lblCon5.Text = parts2(4)
            RetrieveForecastE()

            strMatch = String.Empty

        Catch ex As Exception
            MessageBox.Show("Unexplained Error has occurred," & vbCrLf _
                            & "The 5-Day Weather Forecast" & vbCrLf _
                            & "will be unavailable. Please" & vbCrLf _
                            & "try again later.", "Info to the Rescue", _
                            MessageBoxButtons.OK, MessageBoxIcon.Information)

        End Try
    End Sub

Download NextUI.dll and pWeatherLib.dll

The NextUI.dll and the pWeatherLib.dll can be downloaded HERE. This is in case CodeProject decides to strip out the DLL files. Download, Unzip, Re-Add libs to project. You can download the complete project HERE.

Download WindowsAPICodePack

You can download the WindowsAPICodePack project HERE.

I hope you can use and enjoy this app.

Conclusion

I watch the Weather Channel all the time. Why? you are probably asking yourself. It's because the Weather Channel is the only channel that doesn't have re-runs. Since I have always had a fascination with weather, that's how this application came about.

History

  • This version was created with VB.NET Pro 2010.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Retired
United States United States
I am currently retired.
I have no degree but I have some programming experience
when I was in college(Cobol, Pascal).

My accomplishments thus far are;
Best VB.Net article for January(2009)
Best VB.Net article for July(2009)

Comments and Discussions

 
QuestionMessage to the Developer Pin
Mikloo13-Mar-15 5:36
Mikloo13-Mar-15 5:36 
QuestionHelp with error Pin
Keith O. Williams7-Jun-14 17:10
professionalKeith O. Williams7-Jun-14 17:10 
AnswerRe: Help with error Pin
rspercy6510-Jun-14 4:54
rspercy6510-Jun-14 4:54 
GeneralRe: Help with error Pin
Keith O. Williams11-Jun-14 13:07
professionalKeith O. Williams11-Jun-14 13:07 
Now have over 102 errors. The following names (in bold) have not been declared and need to know how to fix them:

Private Sub frmWeatherDesktop_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

'Panel Animation setup
panels.Add(pnlLocalWeather)
pnlLocalWeather.Location = New Point(0, 0)
panels.Add(pnlTwoDayForecast)
pnlTwoDayForecast.Location = New Point(814, 0)
panels.Add(pnlFiveDayForecast)
pnlFiveDayForecast.Location = New Point(1628, 0)
panels.Add(pnlMaps)
pnlMaps.Location = New Point(2442, 0)
panels.Add(pnlAbout)
pnlAbout.Location = New Point(3256, 0)

For Each panel As Panel In panels
Controls.Add(panel)
Next

animationTimer.Interval = 25
animationTimer.Start()
tooltipTimer.Interval = 50
tooltipTimer.Start()

Dim pathZipsAndWoeIDs As String = Application.StartupPath & "\ZipsandWoeids.txt"
'Dim pathZips As String = Application.StartupPath & "\USZIPS.txt"

'RetrieveRegistryValues()
cmbZip.Items.Clear()
cmbZip.AutoCompleteCustomSource.Clear()
cmbCity.AutoCompleteCustomSource.Clear()
cmbWoeID.Items.Clear()
OpentextFile(pathZipsAndWoeIDs)
ClearTextFields()

Try
Me.Cursor = New Cursor(LoadCursorFromFile(DDcursor))
SetCursorPos((My.Computer.Screen.WorkingArea.Width - Cursor.Size.Width) / 2, _
(My.Computer.Screen.WorkingArea.Height - Cursor.Size.Height) / 2)

'AddHandler buttonNext.Click, AddressOf buttonNext_Click
'AddHandler buttonPrevious.Click, AddressOf buttonPrevious_Click
'AddHandler buttonReset.Click, AddressOf buttonReset_Click
AddHandler WDTimer.Tick, New EventHandler(AddressOf WDTimer_Tick)
AddHandler WVTimer.Tick, New EventHandler(AddressOf WVTimer_Tick)
AddHandler TMPTimer.Tick, New EventHandler(AddressOf TMPTimer_Tick)

AddHandler RichTextBox1.LinkClicked, New LinkClickedEventHandler(AddressOf RichTextBox1_LinkClicked)

TaskbarManager.Instance.ThumbnailToolbars.AddButtons(Me.Handle, buttonReset, buttonPrevious, buttonNext)

buttonNext.IsInteractive = True
buttonNext.Visible = True
buttonPrevious.IsInteractive = True
buttonPrevious.Visible = True
buttonReset.IsInteractive = True
buttonReset.Visible = True

oldTemp = 0
newTemp = 0
oldWindD = 0
newWindD = 0
oldWindS = 0
newWindS = 0

picHeatIndex.ImageLocation = "http://weather.yahoo.com/images/actheat_440x297.jpg"
picWindChill.ImageLocation = "http://image.weather.com/images/maps/forecast/forchill_600x405.jpg"

CreateTempGauge()
CreateWindDirectionGauge()
CreateWindSpeedGauge()

Catch ex As Exception
MessageBox.Show("Weather is not available for your area..." & vbCrLf & _
"Please try again later!" & vbCrLf & vbCrLf & _
"Application will now Close!", "Info to the Rescue")
Application.Exit()
End Try
End Sub

CSS
Private Sub RetrieveZipCode()
        'Code by RSPercy 03/25/2011
        Dim MZ As Integer = CInt(cmbZip.Text)
        Try
            Select Case MZ   'American Zip-Codes
                Case 501, 544, 1001 To 5907, 6001 To 6928, 7001 To 8989, _
                     10001 To 14925, 15001 To 19612, 46001 To 47997, 48001 To 49971
                    picIR.ImageLocation = "http://weather.yahoo.com/images/northeast_sat_440x297.jpg"
                    pbMap.ImageLocation = "http://weather.yahoo.com/images/us_ne_9regradar_medium_usen.jpg"
                    'pbMap3.ImageLocation = "http://weather.yahoo.com/images/na_unitedstates_ne_outlookf_en_US_440_mdy_y.jpg"
                Case 29001 To 29945, 30002 To 31999, 32003 To 34997, 35004 To 36925, 38601 To 39776, 39813 To 39901
                    picIR.ImageLocation = "http://weather.yahoo.com/images/southeast_sat_440x297.jpg"
                    pbMap.ImageLocation = "http://weather.yahoo.com/images/us_se_9regradar_medium_usen.jpg"
                    ' pbMap3.ImageLocation = "http://weather.yahoo.com/images/na_unitedstates_se_outlookf_en_US_440_mdy_y.jpg"
                Case 19701 To 19980, 20101 To 20587, 20588 To 21930, 22001 To 24658, 24701 To 26886, _
                     27006 To 28909, 37010 To 38589, 40003 To 42788, 43001 To 45999
                    picIR.ImageLocation = "http://weather.yahoo.com/images/east_cen_sat_440x297.jpg"
                    pbMap.ImageLocation = "http://weather.yahoo.com/images/us_ec_9regradar_medium_usen.jpg"
                    ' pbMap3.ImageLocation = "http://weather.yahoo.com/images/na_unitedstates_ec_outlookf_en_US_440_mdy_y.jpg"
                Case 70001 To 71497, 71601 To 72959, 73001 To 73198, 73301, 73344, 73401 To 74960, _
                     75001 To 76958, 77001 To 79999, 88510 To 88595
                    picIR.ImageLocation = "http://weather.yahoo.com/images/s_central_sat_440x297.jpg"
                    pbMap.ImageLocation = "http://weather.yahoo.com/images/us_sc_9regradar_medium_usen.jpg"
                    'pbMap3.ImageLocation = "http://weather.yahoo.com/images/na_unitedstates_sc_outlookf_en_US_440_mdy_y.jpg"
                Case 60001 To 62999, 63001 To 65899, 66002 To 66211
                    picIR.ImageLocation = "http://weather.yahoo.com/images/central_sat_440x297.jpg"
                    pbMap.ImageLocation = "http://weather.yahoo.com/images/us_cn_9regradar_medium_usen.jpg"
                    'pbMap3.ImageLocation = "http://weather.yahoo.com/images/na_unitedstates_cn_outlookf_en_US_440_mdy_y.jpg"
                Case 50001 To 52809, 53001 To 54990, 55001 To 56763, 57001 To 57799, 58001 To 58856, 68001 To 69367
                    picIR.ImageLocation = "http://weather.yahoo.com/images/n_central_sat_440x297.jpg"
                    pbMap.ImageLocation = "http://weather.yahoo.com/images/us_nc_9regradar_medium_usen.jpg"
                    'pbMap3.ImageLocation = "http://weather.yahoo.com/images/na_unitedstates_nc_outlookf_en_US_440_mdy_y.jpg"
                Case 59001 To 59937, 83201 To 83887, 97001 To 97920, 98001 To 99403
                    picIR.ImageLocation = "http://weather.yahoo.com/images/northwest_sat_440x297.jpg"
                    pbMap.ImageLocation = "http://weather.yahoo.com/images/us_nw_9regradar_medium_usen.jpg"
                    'pbMap3.ImageLocation = "http://weather.yahoo.com/images/na_unitedstates_nw_outlookf_en_US_440_mdy_y.jpg"
                Case 80001 To 81658, 82001 To 82010, 82050 To 82084, 82190, 82201, _
                82210 To 82244, 82301 To 83128, 83414, 84001 To 84791, 88901 To 89883, 90001 To 96162
                    picIR.ImageLocation = "http://weather.yahoo.com/images/west_cen_sat_440x297.jpg"
                    pbMap.ImageLocation = "http://weather.yahoo.com/images/us_wc_9regradar_medium_usen.jpg"
                    'pbMap3.ImageLocation = "http://weather.yahoo.com/images/na_unitedstates_wc_outlookf_en_US_440_mdy_y.jpg"
                Case 85001 To 85087, 85097 To 85099, 85201 To 85312, 85318, 85320 To 85396, 85501, 85502, _
                     85530 To 85554, 85601 To 85655, 85658, 85662 To 86556, 87001 To 88439
                    picIR.ImageLocation = "http://weather.yahoo.com/images/southwest_sat_440x297.jpg"
                    pbMap.ImageLocation = "http://weather.yahoo.com/images/us_sw_9regradar_medium_usen.jpg"
                    'pbMap3.ImageLocation = "http://weather.yahoo.com/images/na_unitedstates_sw_outlookf_en_US_440_mdy_y.jpg"
                Case 96701 To 96898
                    picIR.ImageLocation = "http://weather.yahoo.com/images/hisat_440x297.jpg"
                    pbMap.ImageLocation = "http://weather.yahoo.com/images/us_hawaii_radar_medium_usen.jpg"
                    'pbMap3.ImageLocation = ""
                Case 99501 To 99950
                    picIR.ImageLocation = "http://weather.yahoo.com/images/aksat_440x297.jpg"
                    pbMap.ImageLocation = "http://weather.yahoo.com/images/us_alaska_radar_medium_usen.jpg"
                    'pbMap3.ImageLocation = ""
                Case Else
                    MessageBox.Show("Please Enter a Valid Zip-Code.")
            End Select
        Catch ex As System.NullReferenceException
            MessageBox.Show(ex.Message & "Please Enter a Valid Zip-Code.", "Info to the Rescue")
            cmbZip.Focus()
        End Try
    End Sub


VB
Private Sub GetAboutInfo()

        'Code by RSPercy 03/25/2011
        Me.LabelProductName.Text = My.Application.Info.ProductName
        Me.LabelVersion.Text = String.Format("Version {0}", My.Application.Info.Version.ToString)
        Me.LabelCopyright.Text = My.Application.Info.Copyright
        Me.LabelCompanyName.Text = My.Application.Info.CompanyName
        Me.TextBoxDescription.Text = My.Application.Info.Description
    End Sub


    Private Sub GetFiveDates()
        'Code by RSPercy 03/25/2011
        LabelDay1.Text = FormatDateTime(Now.Date, DateFormat.ShortDate).ToString()
        LabelDay2.Text = FormatDateTime(DateAdd(DateInterval.Day, 1, Now.Date))
        LabelDay3.Text = FormatDateTime(DateAdd(DateInterval.Day, 2, Now.Date))
        LabelDay4.Text = FormatDateTime(DateAdd(DateInterval.Day, 3, Now.Date))
        LabelDay5.Text = FormatDateTime(DateAdd(DateInterval.Day, 4, Now.Date))
    End Sub


Private Sub Get2DayForecast()
'Code by RSPercy 03/25/2011
Try

lblDate1.Text = FormatDateTime(Now.Date, DateFormat.ShortDate).ToString()
lblDate2.Text = FormatDateTime(DateAdd(DateInterval.Day, 1, Now.Date))

Dim parts() As String
Dim m As Match
Dim strMatch As String = String.Empty
Dim p As New pWeatherLib.pWeatherForecast(cmbZip.Text, temperatureUnit.Fahrenheit)

'''''''''''''''''''''''''''Day, Condition, High, Low
Dim pattern As String = "\w*\s-\s(\w*|\w*\s\w*|\w*\s\w*\s\w*|\w*\s\w*\s\w*\s\w*|\w*\/\w*" &
"|\w*\s\w*\s\w*\/\w*|\w*\/\w*\/\w*|\w*\s\w*\/\w*\s\w*|\w*\s\w*\/\w*|\w*\s\w*\/\w*\-\w*)\.\s\w*:\s(\d{1,3}" &
"|\-\d{1,3})\s\w*:\s(\d{1,3}|\-\d{1,3})"

Dim input As String = p.rss.channel.item.description

For Each m In Regex.Matches(input, pattern, RegexOptions.Multiline)
strMatch = m.Value

If strMatch = Nothing Then
Exit For
Else
strMatch = strMatch.Replace(" - ", ",")
strMatch = strMatch.Replace(". High: ", ",")
strMatch = strMatch.Replace(" Low: ", ",")
'MessageBox.Show(strMatch) 'For testing ONLY
parts = Split(strMatch, ",")
If parts(0) <> p.rss.channel.item.forecast.day Then
lblTomorrow.Text = parts(0)
lblcc2.Text = parts(1)
RetrieveForecastCode()
lblHi2.Text = "High: " & parts(2)
lblLo2.Text = "Low : " & parts(3)
ElseIf parts(0) = p.rss.channel.item.forecast.day Then
lblcc1.Text = parts(1)
RetrieveForecast1()
lblHi1.Text = "High: " & parts(2)
lblLo1.Text = "Low : " & parts(3)
End If
End If
Next

Catch ex As Exception
MessageBox.Show("Sorry...Try again later!", "Info to the Rescue!")
End Try

End Sub

Private Sub GetFiveDayInfo()
'Code by RSPercy 03/25/2011
Try
Dim parts() As String
Dim parts1() As String
Dim parts2() As String

Dim m As Match
Dim strMatch As String = String.Empty

'Finds the 5-day forecast conditions...EX: Partly Cloudy, Rain/Thunder....etc.
'There are 14 different patterns that we need.
Dim patternAA As String = "<[\w]*/>{1}([\w\s/-]*|[\w\s/]*-{1}[der]{1,2})"

'Finds the days oy the week....EX: Mon, Tue, Wed, Thur, Fri, Sat, Sun.
Dim pattern5Day As String = "\<\w*\>\w*\<\/\w*\>\<\w*\>\w*\<\/\w*\>\<\w*\>\w*\<\/\w*\>\<\w*\>\w*\<\/\w*\>\<\w*\>\w*\<\/\w*\>"

'Finds the 5-day forecast Hi's and Low's
Dim patternHiLow As String = "\<\w*\>\w*\:\s(\d{1,3}|\-\d{1,3})\&\#\d{1,3}\;\s\<\w*\>\w*\:\s(\d{1,3}|\-\d{1,3})"


'Create a request using a URL that can receive a post.
Dim request As WebRequest = WebRequest.Create("http://weather.yahoo.com/united-states/" & cmbStates.Text & "/" & cmbCity.Text & "-" & cmbWoeID.Text & "/")

'Create POST data and convert it to a byte array.
request.Method = "POST"
Dim postData As String = "This is a test."

' Set the ContentType property of the WebRequest.
Dim byteArray As Byte() = Encoding.UTF8.GetBytes(postData)

' Set the ContentType property of the WebRequest.
request.ContentType = "application/x-www-form-urlencoded"

' Set the ContentLength property of the WebRequest.
request.ContentLength = byteArray.Length

'Create datastream and a response stream.
Dim dataStream As Stream = request.GetRequestStream()

' Write the data to the request stream, then close it
dataStream.Write(byteArray, 0, byteArray.Length)
dataStream.Close()

' Get the response.
Dim response As WebResponse = request.GetResponse()

' Get the status.
Dim myString As String = CType(response, HttpWebResponse).StatusDescription

' Get the stream containing content returned by the server.
dataStream = response.GetResponseStream()

' Open the stream using a StreamReader for easy access.
Dim sr As StreamReader = New StreamReader(dataStream)

' Put the content in a textbox.
Dim myTB As TextBox = New TextBox
myTB.Multiline = True
myTB.WordWrap = False
myTB.Text = sr.ReadToEnd

' Clean up the streams.
sr.Close()
dataStream.Close()
response.Close()

'Move the content to a string variable.
strMatch = myTB.Text

'Remove the carriage returns and line feeds so our regex patterns work correctly.
strMatch = strMatch.Replace(ControlChars.CrLf, "")
strMatch = strMatch.Replace(ControlChars.Cr, "")
strMatch = strMatch.Replace(ControlChars.Lf, "")

'Reset the textbox to nothing.
myTB.Text = ""

'populate the textbox with the new data
myTB.Text = strMatch

'Reset strMatch to nothing.
strMatch = String.Empty

'Get the Dates for the forecasts
GetFiveDates()

'Get the days of the week.
For Each m In Regex.Matches(myTB.Text, pattern5Day, RegexOptions.Multiline)
strMatch = m.Value

If strMatch = Nothing Then
Exit For
Else
strMatch = strMatch.Replace("", "")
strMatch = strMatch.Replace("", ",")
'MessageBox.Show(strMatch) 'For testing ONLY
parts = Split(strMatch, ",")
If parts(0) = "Today" Then
lblDay1.Text = parts(0)
lblDay2.Text = parts(1)
lblDay3.Text = parts(2)
lblDay4.Text = parts(3)
lblDay5.Text = parts(4)
ElseIf parts(0) = "Tonight" Then
lblDay1.Text = parts(0)
lblDay2.Text = parts(1)
lblDay3.Text = parts(2)
lblDay4.Text = parts(3)
lblDay5.Text = parts(4)
End If
End If
Next

strMatch = String.Empty

'Get the Highs and Lows.
For Each m In Regex.Matches(myTB.Text, patternHiLow, RegexOptions.Multiline)
strMatch += m.Value
Next

strMatch = strMatch.Replace("High: ", ",")
strMatch = strMatch.Replace("°
Low: ", ",")
'MessageBox.Show(strMatch) 'For testing ONLY

parts1 = Split(strMatch, ",")

lblHigh1.Text = "High : " & parts1(1)
lblLow1.Text = "Low : " & parts1(2)
lblHigh2.Text = "High : " & parts1(3)
lblLow2.Text = "Low : " & parts1(4)
lblHigh3.Text = "High : " & parts1(5)
lblLow3.Text = "Low : " & parts1(6)
lblHigh4.Text = "High : " & parts1(7)
lblLow4.Text = "Low : " & parts1(8)
lblHigh5.Text = "High : " & parts1(9)
lblLow5.Text = "Low : " & parts1(10)

strMatch = String.Empty

'Get the five conditions and the Images that we need.
For Each m In Regex.Matches(myTB.Text, patternAA, RegexOptions.Multiline)
strMatch += m.Value
Next
strMatch = strMatch.Replace("
", "")
strMatch = strMatch.Replace("
", ",")

'MessageBox.Show(strMatch) 'For testing ONLY
parts2 = Split(strMatch, ",")

lblCon1.Text = parts2(0)
RetrieveForecastA()
lblCon2.Text = parts2(1)
RetrieveForecastB()
lblCon3.Text = parts2(2)
RetrieveForecastC()
lblCon4.Text = parts2(3)
RetrieveForecastD()
lblCon5.Text = parts2(4)
RetrieveForecastE()

strMatch = String.Empty

Catch ex As Exception
MessageBox.Show("Unexplained Error has occured," & vbCrLf _
& "The 5-Day Weather Forecast" & vbCrLf _
& "will be unavailable. Please" & vbCrLf _
& "try again later.", "Info to the Rescue", MessageBoxButtons.OK, MessageBoxIcon.Information)

End Try
End Sub

Private Sub RetrieveForecastA()
'Code by RSPercy 03/25/2011

'Retrieve the condition for 5 day forecast and
'Add a pic of the current weather condition.
If Trim(lblCon1.Text) = "Tornado" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/1d.png"
ElseIf Trim(lblCon1.Text) = "Tropical Storm" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/1d.png"
ElseIf Trim(lblCon1.Text) = "Hurricane" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/2d.png"
ElseIf Trim(lblCon1.Text) = "Severe Thunderstorms" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/3d.png"
ElseIf Trim(lblCon1.Text) = "Severe T-storms" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/3d.png"
ElseIf Trim(lblCon1.Text) = "Thunderstorms" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/4d.png"
ElseIf Trim(lblCon1.Text) = "T-storms" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/4d.png"
ElseIf Trim(lblCon1.Text) = "Mixed Rain and Snow" Then
lblCon1.Text = "Mixed Rain" & vbCrLf & "and Snow"
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/5d.png"
ElseIf Trim(lblCon1.Text) = "Mixed Rain and Sleet" Then
lblCon1.Text = "Mixed Rain" & vbCrLf & "and Sleet"
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/6d.png"
ElseIf Trim(lblCon1.Text) = "Mixed Snow and Sleet" Then
lblCon1.Text = "Mixed Snow" & vbCrLf & "and Sleet"
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/7d.png"
ElseIf Trim(lblCon1.Text) = "Freezing Drizzle" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/8d.png"
ElseIf Trim(lblCon1.Text) = "Drizzle" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/9d.png"
ElseIf Trim(lblCon1.Text) = "AM Drizzle" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/9d.png"
ElseIf Trim(lblCon1.Text) = "PM Drizzle" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/9d.png"
ElseIf Trim(lblCon1.Text) = "Drizzle Early" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/9d.png"
ElseIf Trim(lblCon1.Text) = "Drizzle Late" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/9d.png"
ElseIf Trim(lblCon1.Text) = "Drizzle/Fog" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/9d.png"
ElseIf Trim(lblCon1.Text) = "Freezing Rain" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/10d.png"
ElseIf Trim(lblCon1.Text) = "Showers" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/11d.png"
ElseIf Trim(lblCon1.Text) = "Snow Flurries" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/13d.png"
ElseIf Trim(lblCon1.Text) = "Light Snow Showers" Then
lblCon1.Text = "Light" & vbCrLf & "Snow Showers"
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/14d.png"
ElseIf Trim(lblCon1.Text) = "Blowing Snow" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/15d.png"
ElseIf Trim(lblCon1.Text) = "Snow" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/16d.png"
ElseIf Trim(lblCon1.Text) = "Hail" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/17d.png"
ElseIf Trim(lblCon1.Text) = "Sleet" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/18d.png"
ElseIf Trim(lblCon1.Text) = "Dust" Then 'Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/19d.png"
ElseIf Trim(lblCon1.Text) = "Dust" Then 'Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/19n.png"
ElseIf Trim(lblCon1.Text) = "Foggy" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/20d.png"
ElseIf Trim(lblCon1.Text) = "AM Fog/PM Sun" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/20d.png"
ElseIf Trim(lblCon1.Text) = "Haze" Then 'Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/21d.png"
ElseIf Trim(lblCon1.Text) = "Haze" Then 'Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/21n.png"
ElseIf Trim(lblCon1.Text) = "Smoky" Then 'Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/22d.png"
'ElseIf Trim(lblCon1.Text) = "Smoky" Then 'Then
'pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/22n.png"
ElseIf Trim(lblCon1.Text) = "Blustery" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/23d.png"
ElseIf Trim(lblCon1.Text) = "Windy" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/24d.png"
ElseIf Trim(lblCon1.Text) = "Cold" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/25d.png"
ElseIf Trim(lblCon1.Text) = "Cloudy" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/26d.png"
ElseIf Trim(lblCon1.Text) = "Cloudy/Wind" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/26d.png"
ElseIf Trim(lblCon1.Text) = "Mostly Cloudy" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/28d.png"
ElseIf Trim(lblCon1.Text) = "Mostly Cloudy/Wind" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/28d.png"
ElseIf Trim(lblCon1.Text) = "Mostly Cloudy/Win-d" Then
lblCon1.Text = "Mostly" & vbCrLf & "Cloudy/Wind"
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/28d.png"
ElseIf Trim(lblCon1.Text) = "Partly Cloudy" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/30d.png"
ElseIf Trim(lblCon1.Text) = "Partly Cloudy/Wind" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/30d.png"
ElseIf Trim(lblCon1.Text) = "Partly Cloudy/Win-d" Then
lblCon1.Text = "Partly" & vbCrLf & "Cloudy/Wind"
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/30d.png"
ElseIf Trim(lblCon1.Text) = "Clouds Late/Clearing Early" Then
lblCon1.Text = "Clouds Late/" & vbCrLf & "Clearing Early"
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/26d.png"
ElseIf Trim(lblCon1.Text) = "Clouds Early/Clearing Late" Then
lblCon1.Text = "Clouds Early/" & vbCrLf & "Clearing Late"
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/26d.png"
ElseIf Trim(lblCon1.Text) = "Clear" And lblDay1.Text = "Tonight" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/31n.png"
ElseIf Trim(lblCon1.Text) = "Clear" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/31d.png"
ElseIf Trim(lblCon1.Text) = "Mostly Clear" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/31d.png"
ElseIf Trim(lblCon1.Text) = "AM Clear" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/31d.png"
ElseIf Trim(lblCon1.Text) = "PM Clear" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/31n.png"
ElseIf Trim(lblCon1.Text) = "Mostly Sunny" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/32d.png"
ElseIf Trim(lblCon1.Text) = "Mostly Sunny/Wind" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/32d.png"
ElseIf Trim(lblCon1.Text) = "Mostly Sunny/Win-d" Then
lblCon1.Text = "Mostly" & vbCrLf & "Sunny/Wind"
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/32d.png"
ElseIf Trim(lblCon1.Text) = "Sunny" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/32d.png"
ElseIf Trim(lblCon1.Text) = "Sunny/Wind" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/32d.png"
ElseIf Trim(lblCon1.Text) = "Fair" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/33d.png"
ElseIf Trim(lblCon1.Text) = "Mixed Rain and Hail" Then
lblCon1.Text = "Mixed Rain" & vbCrLf & "and Hail"
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/35d.png"
ElseIf Trim(lblCon1.Text) = "Hot" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/36d.png"
ElseIf Trim(lblCon1.Text) = "Isolated Thunderstorms" Then
lblCon1.Text = "Isolated" & vbCrLf & "Thunderstorms"
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/37d.png"
ElseIf Trim(lblCon1.Text) = "Isolated T-storms/W-ind" Then
lblCon1.Text = "Isolated" & vbCrLf & "T-storms" & vbCrLf & "Wind"
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/37d.png"
ElseIf Trim(lblCon1.Text) = "Isolated T-storms" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/37d.png"
'ElseIf Trim(lblCon1.Text) = "Isolated T-storms" Then
' lblCon1.Text = "Isolated T-storms"
' pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/37d.png"
ElseIf Trim(lblCon1.Text) = "Scattered Thunderstorms" Then
lblCon1.Text = "Scattered" & vbCrLf & "Thunderstorms"
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/38d.png"
ElseIf Trim(lblCon1.Text) = "Scattered T-storms" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/38d.png"
ElseIf Trim(lblCon1.Text) = "Scattered Thunderstorms/Wind" Then
lblCon1.Text = "Scattered" & vbCrLf & "Thunderstorms/Wind"
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/38d.png"
ElseIf Trim(lblCon1.Text) = "Scattered Strong Storms/Win-d" Then
lblCon1.Text = "Scattered Strong" & vbCrLf & "Storms/Wind"
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/38d.png"
ElseIf Trim(lblCon1.Text) = "Strong Storms" Then
lblCon1.Text = "Strong" & vbCrLf & "Storms"
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/38d.png"
ElseIf Trim(lblCon1.Text) = "Strong Storms/Win-d" Then
lblCon1.Text = "Strong" & vbCrLf & "Storms/Winds"
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/38d.png"
ElseIf Trim(lblCon1.Text) = "Scattered Strong Storms" Then
lblCon1.Text = "Scattered" & vbCrLf & "Strong" & vbCrLf & "Storms"
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/38d.png"
ElseIf Trim(lblCon1.Text) = "Scattered T-storms/Wind" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/38d.png"
ElseIf Trim(lblCon1.Text) = "Scattered T-storms/Win-d" Then
lblCon1.Text = "Scattered" & vbCrLf & "T-storms/Wind"
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/38d.png"
ElseIf Trim(lblCon1.Text) = "PM Thunderstorms" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/38n.png"
ElseIf Trim(lblCon1.Text) = "PM T-storms" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/38n.png"
ElseIf Trim(lblCon1.Text) = "PM T-storms/W-ind" Then
lblCon1.Text = "PM T-storms" & vbCrLf & "/Wind"
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/39n.png"
ElseIf Trim(lblCon1.Text) = "AM T-storms/W-ind" Then
lblCon1.Text = "AM T-storms" & vbCrLf & "/Wind"
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/39d.png"
ElseIf Trim(lblCon1.Text) = "Thunderstorms Late" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/38n.png"
ElseIf Trim(lblCon1.Text) = "AM Thunderstorms" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/38d.png"
ElseIf Trim(lblCon1.Text) = "AM T-storms" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/38d.png"
ElseIf Trim(lblCon1.Text) = "T-storms Early" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/38d.png"
ElseIf Trim(lblCon1.Text) = "Thunderstorms Early" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/38d.png"
ElseIf Trim(lblCon1.Text) = "PM Showers" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/39n.png"
ElseIf Trim(lblCon1.Text) = "PM Showers/Wind" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/39n.png"
ElseIf Trim(lblCon1.Text) = "PM Showers/Win-d" Then
lblCon1.Text = "PM Showers" & vbCrLf & "/Wind"
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/39n.png"
ElseIf Trim(lblCon1.Text) = "Light Rain" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/9d.png"
ElseIf Trim(lblCon1.Text) = "Rain" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/9d.png"
ElseIf Trim(lblCon1.Text) = "Rain/Snow" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/9d.png"
ElseIf Trim(lblCon1.Text) = "AM Rain" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/9d.png"
ElseIf Trim(lblCon1.Text) = "PM Rain" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/9n.png"
ElseIf Trim(lblCon1.Text) = "Heavy Rain" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/10d.png"
ElseIf Trim(lblCon1.Text) = "Heavy Rain/Wind" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/10d.png"
ElseIf Trim(lblCon1.Text) = "Heavy Rain/Win-d" Then
lblCon1.Text = "Heavy" & vbCrLf & "Rain/Wind"
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/10d.png"
ElseIf Trim(lblCon1.Text) = "Heavy Thunderstorms" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/3d.png"
ElseIf Trim(lblCon1.Text) = "Heavy T-storms" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/3d.png"
ElseIf Trim(lblCon1.Text) = "Rain Early" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/9d.png"
ElseIf Trim(lblCon1.Text) = "AM Showers" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/39d.png"
ElseIf Trim(lblCon1.Text) = "AM Showers/Wind" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/39d.png"
ElseIf Trim(lblCon1.Text) = "AM Showers/Win-d" Then
lblCon1.Text = "AM Showers" & vbCrLf & "/Wind"
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/39d.png"
ElseIf Trim(lblCon1.Text) = "Showers Early" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/39d.png"
ElseIf Trim(lblCon1.Text) = "Showers/Wind" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/9d.png"
ElseIf Trim(lblCon1.Text) = "Rain/Wind" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/10d.png"
ElseIf Trim(lblCon1.Text) = "Rain/Thunder/Wind" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/10d.png"
ElseIf Trim(lblCon1.Text) = "Few Showers" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/39d.png"
ElseIf Trim(lblCon1.Text) = "Few Showers/Wind" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/39d.png"
ElseIf Trim(lblCon1.Text) = "Few Showers/Win-d" Or Trim(lblCon1.Text) = "Few Showers/Wi-nd" Then
lblCon1.Text = "Few Showers" & vbCrLf & "/Wind"
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/39d.png"
ElseIf Trim(lblCon1.Text) = "Showers Late" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/39n.png"
ElseIf Trim(lblCon1.Text) = "Scattered Showers" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/40d.png"
ElseIf Trim(lblCon1.Text) = "Heavy Snow" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/41d.png"
ElseIf Trim(lblCon1.Text) = "Scattered Snow Showers" Then
lblCon1.Text = "Scattered" & vbCrLf & "Snow Showers"
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/42d.png"
ElseIf Trim(lblCon1.Text) = "Thundershowers" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/45d.png"
ElseIf Trim(lblCon1.Text) = "T-showers" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/45d.png"
ElseIf Trim(lblCon1.Text) = "Snow Showers" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/46d.png"
ElseIf Trim(lblCon1.Text) = "AM Thundershowers" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/47d.png"
ElseIf Trim(lblCon1.Text) = "PM Thundershowers" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/47n.png"
ElseIf Trim(lblCon1.Text) = "AM T-showers" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/47d.png"
ElseIf Trim(lblCon1.Text) = "PM T-showers" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/47n.png"
ElseIf Trim(lblCon1.Text) = "Isolated Thundershowers" Then
lblCon1.Text = "Isolated" & vbCrLf & "Thundershowers"
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/47d.png"
ElseIf Trim(lblCon1.Text) = "Isolated T-showers" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/47d.png"
ElseIf Trim(lblCon1.Text) = "Rain/Thunder" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/8d.png"
ElseIf Trim(lblCon1.Text) = "Rain/Thund-er" Then
lblCon1.Text = "Rain/Thunder"
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/8d.png"
ElseIf Trim(lblCon1.Text) = "AM Clouds/PM Sun" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/30d.png"
ElseIf Trim(lblCon1.Text) = "AM Sun/PM Clouds" Then
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/30d.png"
ElseIf Trim(lblCon1.Text) = "" Then
lblCon1.Text = "Not Available"
pbDay1.ImageLocation = "http://l.yimg.com/a/i/us/nws/weather/gr/44d.png"
End If
End Sub

I have a Handles clause requires a WithEvents variable defined in the containing type or one of its base types error on the line in bold.

VB
Private Sub RichTextBox1_LinkClicked(ByVal sender As Object, ByVal e As System.Windows.Forms.LinkClickedEventArgs) Handles RichTextBox1.LinkClicked
        'Code by RSPercy 03/25/2011
        Process.Start(e.LinkText)
    End Sub


I will have some more errors for you after these are cleared up. Thanks for your help. BTW: I am using VB Studio Professional 2010.
SuggestionRe: Help with error Pin
rspercy6512-Jun-14 7:55
rspercy6512-Jun-14 7:55 
GeneralRe: Help with error Pin
Keith O. Williams12-Jun-14 8:35
professionalKeith O. Williams12-Jun-14 8:35 
AnswerRe: Help with error Pin
timnboys11-Aug-14 10:23
timnboys11-Aug-14 10:23 
GeneralMy vote of 5 Pin
Аslam Iqbal23-Sep-12 22:51
professionalАslam Iqbal23-Sep-12 22:51 
GeneralRe: My vote of 5 Pin
rspercy6524-Sep-12 1:58
rspercy6524-Sep-12 1:58 
QuestionMay you help me to get weather data from " weather.service.msn.com " Pin
richmasua12-Sep-12 12:45
richmasua12-Sep-12 12:45 
QuestionDoes anyone know why this application gives high temperature? Pin
richmasua27-Aug-12 10:45
richmasua27-Aug-12 10:45 
AnswerRe: Does anyone know why this application gives high temperature? Pin
rspercy6527-Aug-12 13:08
rspercy6527-Aug-12 13:08 
QuestionHow Can I use the currenthurricane api on the wunderground api to tell what the current hurricanes are? Pin
timnboys22-Aug-12 10:43
timnboys22-Aug-12 10:43 
AnswerRe: How Can I use the currenthurricane api on the wunderground api to tell what the current hurricanes are? Pin
rspercy6527-Aug-12 13:13
rspercy6527-Aug-12 13:13 
AnswerRe: How Can I use the currenthurricane api on the wunderground api to tell what the current hurricanes are? Pin
rspercy6513-Jan-13 11:42
rspercy6513-Jan-13 11:42 
GeneralRe: How Can I use the currenthurricane api on the wunderground api to tell what the current hurricanes are? Pin
timnboys21-Jan-13 7:21
timnboys21-Jan-13 7:21 
SuggestionRe: How Can I use the currenthurricane api on the wunderground api to tell what the current hurricanes are? Pin
rspercy6521-Jan-13 13:03
rspercy6521-Jan-13 13:03 
GeneralRe: How Can I use the currenthurricane api on the wunderground api to tell what the current hurricanes are? Pin
timnboys23-Jan-13 17:24
timnboys23-Jan-13 17:24 
SuggestionRe: How Can I use the currenthurricane api on the wunderground api to tell what the current hurricanes are? Pin
rspercy6523-Jan-13 17:34
rspercy6523-Jan-13 17:34 
GeneralRe: How Can I use the currenthurricane api on the wunderground api to tell what the current hurricanes are? Pin
timnboys2-Mar-13 10:23
timnboys2-Mar-13 10:23 
QuestionThank you, it helped me a lot, one suggestion though Pin
olivewarbler10-Aug-12 13:43
olivewarbler10-Aug-12 13:43 
QuestionCould A Condition in pWeatherLib.dll Like Severe Weather, Tornado, etc. Be Considered a warning? Pin
timnboys15-Jul-12 11:16
timnboys15-Jul-12 11:16 
AnswerRe: Could A Condition in pWeatherLib.dll Like Severe Weather, Tornado, etc. Be Considered a warning? Pin
rspercy6516-Jul-12 3:35
rspercy6516-Jul-12 3:35 
GeneralRe: Could A Condition in pWeatherLib.dll Like Severe Weather, Tornado, etc. Be Considered a warning? Pin
timnboys17-Jul-12 10:07
timnboys17-Jul-12 10:07 
AnswerRe: Could A Condition in pWeatherLib.dll Like Severe Weather, Tornado, etc. Be Considered a warning? Pin
rspercy6517-Jul-12 13:31
rspercy6517-Jul-12 13:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.