我无法从ListBox
我试过了,但它没有用
Dim rnd As New Random
Dim randomIndex As Integer = rnd.Next(0, ListBox1.Items.Count)
ListBox1.Items.Remove(randomIndex)
答案 0 :(得分:0)
RemoveAt
方法删除实际项目,而不是索引。要按索引删除,请使用cilkplus.org:
Dim rnd As New Random
Dim randomIndex As Integer = rnd.Next(0, ListBox1.Items.Count)
ListBox1.Items.RemoveAt(randomIndex)