View Full Version : Does not update labels

01-28-2007, 06:48 PM

I'm writing this VB.net script and I'm having a bit of trouble. Here is the code.

Public Sub updateMetar()
Dim metar As String
Dim winds As String
Dim runways As String
Dim windSpd As Integer
Dim dir As Integer

mysql.ConnectionString = "xxxxxxx"


Dim mySelectQuery As String = "SELECT * FROM `weather` WHERE icao='" & airport & "'"
Dim myCommand As New MySqlCommand(mySelectQuery, mysql)
Dim myReader As MySqlDataReader
myReader = myCommand.ExecuteReader()

If myReader.HasRows Then
metar = myReader.GetString(11) 'metar column
winds = myReader.GetString(4) 'winds column

windSpd = Convert.ToInt32(Mid(winds, 4, 2))
dir = Convert.ToInt32(Mid(winds, 1, 3))

runways = findRunways(dir, windSpd)
lblMetarText.Text = metar
lblRunwayText.Text = runways

lblMetarText.Text = "Airport Not Found"
lblRunwayText.Text = "Airport Not Found"
End If

End Sub

Basically what happens is a call this from main.vb, my main form. The first time it's called the labels update correctly. However, the form is also created when it is first called. If the function is called again without the form being closed, redeclared, and opened, the function still downloads the correct data, but the labels do not update. Any idea why this is?

Thanks alot!