Hi all! I'm working on a program. It's some sort of a slideshow program. It works fine until one moment, when an OutOfMemory exception appears. Here's the code:
Code:
Private Sub TimerCase2_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles TimerCase2.Tick
        Dim loop2_1 As Integer = CType(txtLoop2_1.Text, Integer)
        Dim loop2_2 As Integer = CType(txtLoop2_2.Text, Integer)
        intNumberOfLoops += 1
        If intNumberOfLoops > loop2_1 Then
            If Not intNumberOfLoops = 0 Then
                intNumberOfLoops += 1
            End If
            If intNumberOfLoops > loop2_2 Then
                Previewer.PictureBox1.Image = Nothing
            End If
            CurrentImage = CurrentImage + 1
            If CurrentImage > Case2Images2.Count Then
                CurrentImage = 0
            End If
            Previewer.PictureBox1.Image = Image.FromFile(Case2Images2.Item(CurrentImage))
        End If
        CurrentImage = (CurrentImage + 1)
        If CurrentImage > Case2Images1.Count Then
            CurrentImage = 0
        End If
        Previewer.PictureBox1.Image = Image.FromFile(Case2Images1.Item(CurrentImage))
    End Sub
Please help me fix the problem. I'm not familiar with this kind of exceptions.
Thanks in advance!