I am working in VB in C# I have a pictureBox where every 30 seconds I change an image there are a total of 8 images the problem is that when I finish changing all the images I don't know how to make the timer return to 0 so that this is reflected in a Label and start running the images again.
Thanks in advance.
CodePudding user response:
In VB
Private ImgListPath As List(Of String) '8
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Static whPicIdx As Integer = 0
Dim ct As Integer = ImgListPath.Count
PictureBox1.Load(ImgListPath(whPicIdx))
whPicIdx = 1
If whPicIdx >= ct Then
whPicIdx = 0
End If
End Sub
CodePudding user response:
You can reset the timer using the code:
myTimer.stop();
myTimer.start();
Just change the [myTimer] to your timer's control name.
Also you could check up this documentation: Timer.stop