我正在尝试遍历列表框项目,并在每个项目之间有一个倒计时和其他代码,但它只是无法正常工作 - 完全。它不会在列表框项目之间暂停。
它应该像这样工作:
获取列表框项目获取随机数并使用列表框项目计数标签放入标签运行代码向下重复下一个项目
Private Sub Timer1_Tick() Handles Timer1.Tick
'loop each item to search
For i As Integer = 0 To ListBox1.Items.Count - 1
'code to run based on listbox1
MsgBox(ListBox1.Items(i))
'get time to wait
Dim seconds As String() = TextBox1.Text.Split("-")
Dim snum1 As Integer = seconds(0)
Dim snum2 As Integer = seconds(seconds.Length - 1)
Dim RandomClass2 As New Random()
Dim RandomNumber2 As Integer
If snum2 < snum1 Then
snum2 = snum1
End If
RandomNumber2 = RandomClass2.Next(snum1, snum2)
Label7.Text = RandomNumber2 & " seconds"
' MsgBox(RandomNumber2 & " seconds")
timeLeft = RandomNumber2
If timeLeft > 0 Then
timeLeft -= 1
Label7.Text = timeLeft & " seconds"
Else
Timer1.Stop()
Label7.Text = "---"
End If
Next
End Sub