I am writing an application that displays photos. I need to be able to stop the SlideShow when the user presses the "Stop" button. Right now, what's happening when the Stop button is pressed, is a public variable, bStop, is set to True. It works sort-of, and it also takes a long time. There must be a better way. Any ideas?
Private Sub SlideShow() Dim x As Integer = 0 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 End With End Sub