I use this code to move to next index listBox1.SelectedIndex = listBox1.SelectedIndex +1;
but the problem is when I am on the last index and I click the button next that have that code is crash any suggestions to make next button back to the first index after click it ??
Code to select next item:
if (listBox1.SelectedIndex < listBox1.Items.Count - 1)
{
listBox1.SelectedIndex += 1;
}
else
{
listBox1.SelectedIndex = 0;
}