Hello I am making an imageviewer in c#. The thing is that works correctly, I can see on click the next image.
But for values = 5 and =-1
gives me an exception.
How to fix this my code is this?
I get this message
InvalidArgument=Value of '-1' is not valid for 'index'.
Code:
int I;
if (pictureBox2.Visible == true)
{
I = I - 1;
pictureBox2.Image = imageList2.Images[I];
}
This image list has 4 pictures with + goes up to the fourth then with the code above goes down to the first one.
When I press the button one more time it gives me the error message that I am describing how can I fix this?