...

View Full Version : Does not update labels



FuZion
01-28-2007, 05:48 PM
Hello,

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"

mysql.Open()

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

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

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

mysql.Close()
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!

FuZion



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum