So, I basically want to be able to enter text into a text box, click a button, and have that text added to a dictionary to later populate a combobox. ultimately, I need the combobox items to have a static value to reference. realistically, I would like these values to be able to be saved and loaded. Is this possible or is there a better way to do this?
this code is broken, just for reference.
Private Sub PlayerAddBT_Click(sender As Object, e As EventArgs) Handles PlayerAddBT.Click
PlayerName.DisplayMember = "value"
PlayerName.ValueMember = "key"
Dim Players As New Dictionary(Of String, String)
Players.Add(1, Me.PlayerAdd.Text)
Me.PlayerAdd.Text = String.Empty
For i As Integer = 0 To Players.Count - 1
PlayerName.Items.Add(Players.Values(i))
Next
''' pull values from combobox and display
PlayerName.DataSource = New BindingSource(Players, Nothing)
AddHandler PlayerName.SelectedIndexChanged, AddressOf Playername_SelectedIndexChanged
End Sub
No comments:
Post a Comment