-1

I want to know how I can add TextBox text to the start of some of items in my Listbox. For example when I type 'Game 1' in the TextBox it shows that at each timing like Game 1: 00:00:00 and if I type 'Game 2' It shows it like Game 2: 00:00:00 .

I am using VB.Net, any help would be appreicated

4

1 回答 1

0

如果您正在使用,VB.net那么假设您想更改您的最后一项,Listbox那么您可以使用以下代码:

  Dim itm As String = ListBox1.Items(ListBox1.Items.Count - 1)
  ListBox1.Items(ListBox1.Items.Count - 1) = TextBox1.Text + itm

如果您希望从中选择的项目Listbox将添加文本框的值,那么您可以使用SelectedIndex属性,例如:

 Dim itm As String = ListBox1.Items(ListBox1.SelectedIndex)
 ListBox1.Items(ListBox1.SelectedIndex) = TextBox1.Text + itm
于 2013-08-09T09:50:50.600 回答