Hi can somebody help me. This is my coding for button Next and Previous but when I click on next it just goes to next like from pictures 1 and 2 to pic 3 and 4 but not any more because i have pictures in two imagelist upto 20 but it doesnt work and the coding for button previous also doesnt work same problem.
Next Button Coding
Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click
Static imagenumber As Integer
Try
imagenumber -= 1
imageNumber = 0
If imageNumber = 0 Or imageNumber < 0 Then
imageNumber = ++1
PictureBox1.Image = ImageList1.Images(imageNumber)
PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
End If
imageNumber += 1
imageNumber = 0
If imageNumber > 0 Or imageNumber = 0 Then
imageNumber = ++1
PictureBox1.Image = ImageList1.Images(imageNumber)
PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
imageNumber -= 1
imageNumber = 0
If imageNumber = 0 Or imageNumber < 0 Then
imageNumber = ++1
PictureBox2.Image = ImageList2.Images(imageNumber)
PictureBox2.SizeMode = PictureBoxSizeMode.StretchImage
End If
imageNumber += 1
imageNumber = 0
If imageNumber > 0 Or imageNumber = 0 Then
imageNumber = ++1
PictureBox2.Image = ImageList2.Images(imageNumber)
PictureBox2.SizeMode = PictureBoxSizeMode.StretchImage
End If
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Previous Button coding
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Static imageNumber As Integer
Try
If Not imageNumber > 0 Then
imageNumber = --1
PictureBox1.Image = ImageList1.Images(imageNumber)
PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
End If
If Not imageNumber > 0 Then
imageNumber = --1
PictureBox2.Image = ImageList2.Images(imageNumber)
PictureBox2.SizeMode = PictureBoxSizeMode.StretchImage
End If
Catch ex As Exception
End Try
End Sub