Hello everyone, the listBox element has such a SelectedIndex property. For example, I have 4 items in the element, but this value can change and I will not know what their number is, when the timer is activated, the code goes


And when this value reached a maximum (in our case 4), make such a code

 listBox1.SelectedItem = 0; 

I do not understand how to get the maximum index, I tried listBox1.Items.Count, but Indices are counting from 0, not from 1.

  • 2
    Here you just need to turn on the logic, which you, apparently, do not have ... - AseN
  • 2
    Probably it is just too late and the brain is tired all day, at such a time it is better not to write code, otherwise it will be very crooked. - Specter
  • Thank you, laughed heartily) - semenvx27
  • one
    where did you get such a rating, with such a reference) - IntegralAL

1 answer 1

listBox1.Items.Count - 1, not?


Using this property, you can get a link to the list of items currently stored in the ListBox object.