这是代码:
Private Sub Video1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Video1.Tick
ToolStripStatusLabel4.Text += 1
currentIndex += 1
ListBox1.SelectedIndex = currentIndex
Video1.Interval = rnd.Next(90000, 95000)
WebBrowser1.Navigate(ListBox1.SelectedItem)
End Sub
选择最后一项后,我出错了界限错误。我希望它在到达那个阶段时停止计时器。怎么可能呢?
答案 0 :(得分:0)
使用计数器确定列表框中的总项目。
Dim totalItem As Integer
totalItem = ListBox1.Items.Count
'Stop the timer if the currentIndex exceeds totalItem variable.
If currentIndex = totalItem - 1 Then
Timer1.Enabled = False
End If