Vb.net 如何将项目添加到列表框中特定次数?

Vb.net 如何将项目添加到列表框中特定次数?,vb.net,listbox,Vb.net,Listbox,我想根据输入向列表框添加特定次数的项目。例如,如果我输入5,它应该在列表框中添加5次“DOG”。到目前为止,我的代码是: Dim number As Integer number = TextBox1.Text Dim add As String add = POS.DescriptionText.Text While number = add POS.ListBox1.Items.Add(number) End While 使用此代码: Dim text = "DOG" // mayb

我想根据输入向列表框添加特定次数的项目。例如,如果我输入5,它应该在列表框中添加5次“DOG”。到目前为止,我的代码是:

Dim number As Integer
number = TextBox1.Text
Dim add As String
add = POS.DescriptionText.Text
While number = add
   POS.ListBox1.Items.Add(number)
End While
使用此代码:

Dim text = "DOG" // maybe POS.DescriptionText.Text according to your code
For X As Integer = 1 To Integer.Parse(TextBox1.Text)
    POS.ListBox1.Items.Add(text)
Next

请澄清你的问题。你的问题毫无意义。雅虎回答本周不起作用吗?谢谢你,先生。它现在起作用了