How do I handle the index changing in the combobox?
The second code shows what I am trying to do, except for multiple combobox's that are made on runtime.
For i As Integer = 0 To weightClass.GetUpperBound(0)
Dim player As New ComboBox
Dim playerPosition As New TableLayoutPanelCellPosition(1, i)
player.Name = "PlayerComboBox_" & i
player.Size = New System.Drawing.Size(240, 40)
cmd.CommandText = "SELECT FIRSTNAME, LASTNAME FROM MY_TEAM WHERE WEIGHT = " & weightClass(i)
myReader = cmd.ExecuteReader
Do While myReader.Read()
player.Items.Add(myReader("LASTNAME") & ", " & myReader("FIRSTNAME"))
Loop
TableLayoutPanel1.SetCellPosition(player, playerPosition)
TableLayoutPanel1.Controls.Add(player)
Next
Private Sub ComboBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
loadPlayerdata()
End Sub

New Topic/Question
Reply



MultiQuote






|