Hi,
Use Timer control instead of Thread.Sleep (). Because ur application will freeze for the given milliseconds.
if you use timer control, you can disable the timer when stop button is clicked.
To use timer, change the Following
> Use X as Global variable
> Draw a Timer Control and Set Enabled Property to True and Interval property to 3000
> Place the above code into Timer_Tick event
Dim x As Integer = 0
Private Sub Timer1_Tick ( ... )
With cboFileNames
'For x = 0 To (.Items.Count) - 1
'If bStop Then Exit For
PictureBox1.Image = Image.FromFile(.Items(x).ToString)
My.Application.DoEvents()
'Threading.Thread.Sleep(3000)
'Next
x = x + 1
End With
End Sub
Private Sub ButtonStop_Click( .. )
Timer1.Enabled = False
End Sub
Note : Also Check the x value whether it is inside upper and lower bound value inside TImer1_Tick Event