IO error
Hi Janobe. Thanks for your tutorial! Created the project in the way you describe it, but form load event causes an IO error - i.e file not found???
'Set an Array of images Dim pics() As String = {"image1.jpg", "image2.jpg", "image3.jpg", "image4.jpg", "image5.jpg"} 'Set this to use in incrementing an array index. Dim i As Integer = 0
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load 'Set the first image in the first load of the form. PictureBox1.Image = Image.FromFile("images/" + pics(0)) End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick 'Set this formula to increment i by 1 i += 1 'Set a validation of pictures If pics.Length = i Then i = 0 End If 'Set to Load the image. PictureBox1.Image = Image.FromFile("images/" + pics(i)) End Sub
Private Sub ToolStripButton2_Click(sender As Object, e As EventArgs) Handles btnNext.Click 'Disable timer to prevent the next image from loading.. Timer1.Enabled = False 'Set this formula to increment i by 1 i += 1 'Set a validation of pictures If pics.Length = i Then i = 0 End If 'Set to Load the image. PictureBox1.Image = Image.FromFile("images/" + pics(i)) 'Re-Enable timer to resets the image loads in 5 seconds.. Timer1.Enabled = True End Sub
Private Sub ToolStripButton2_Click(sender As Object, e As EventArgs) Handles btnNext.Click 'Disable timer to prevent the next image from loading.. Timer1.Enabled = False 'Set this formula to decrement i by 1 i -= 1 'Set a validation of pictures If pics.Length = i Then i = 0 End If 'Set to Load the image. PictureBox1.Image = Image.FromFile("images/" + pics(i)) 'Re-Enable timer to resets the image loads in 5 seconds.. Timer1.Enabled = True End Sub