Reputation: 7795
How can i change a value in a VB Listbox?
Like this it doesn't work:
listbox.selectedItem = "Newvalue"
THX for help
Upvotes: 2
Views: 5440
Reputation: 3810
Adding items to listbox:
ListBox1.Items.Add("AA")
ListBox1.Items.Add("BB")
ListBox1.Items.Add("CC")
ListBox1.Items.Add("DD")
now select anyone 1 option in the listbox:
Add this code in your button click
ListBox1.SelectedItem.Text = "newvalue"
the selected option/value "CC" is changed to "newvalue"
Upvotes: 1