开发者

VB Listbox change value

开发者 https://www.devze.com 2023-01-24 22:44 出处:网络
How can i change a value in a VB Listbox? Like this it doesn\'t work: listbox.selectedItem = \"Newvalue\"

How can i change a value in a VB Listbox?

Like this it doesn't work:

listbox.selectedItem = "Newvalue"

THX fo开发者_开发百科r help


listbox.List(listbox.ListIndex) = "NewValue"


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:

VB Listbox change value

Add this code in your button click

ListBox1.SelectedItem.Text = "newvalue"

VB Listbox change value

the selected option/value "CC" is changed to "newvalue"

0

精彩评论

暂无评论...
验证码 换一张
取 消