This is a tennis tournament simulation program I'm Trying to make a tree. Everything its working perfectly but I have a big problem. I can't progress to the next stage with the winners of the firts games. Because I can't change the "target" label where I want to write the winners name. Here's a print:
This is how I Generate the winners who is going to the next stage and it actually works.~
Public Sub Gerar_Vencedor(Atleta1, Atleta2)
Using con As New OleDb.OleDbConnection
con.ConnectionString = "Provider = Microsoft.ACE.OLEDB.12.0;" &
"Data Source = E:\dev\Ganso\BaseDados_ClubeTenis.accdb"
con.Close()
con.Open()
Dim busca = "Select Vencedor From Jogo Where idAtleta1 = '" & Atleta1 & "' and idAtleta2 = '" & Atleta2 & "'"
Dim cmd As OleDbCommand = New OleDbCommand(busca, con)
Dim dr As OleDbDataReader = cmd.ExecuteReader()
' A variável sql vai receber a string para fazer o select a base de dados
'Try
' é aberta ligação a Bdados
' declaração de um comando que vai executar a instrução sql na base de dados
' variável que vai receber os registos resultantes da instrução sql
' ciclo que vai percorrer todos os registos do comando anterior
While dr.Read()
Label9.Text = dr("Vencedor")
End While
con.Close()
End Using
End Sub
My problem is that Label9.Text = dr("Vencedor")
because everytime I get a winner it goes to label9.
My final question is: Is there anyway to dynamically change the label without repeating this function over and over.
Thanks.