title: VB.NET Listbox selectedindex
body: <p>In my code i select excel files to add them to a listbox, I then run some code that will replace a certain cell on all excel files in the list. Everytime it changes a cell in the excel file it will go to the next one in the listbox using </p>
  
  <pre><code>Me.ListBox2.SelectedIndex = Me.ListBox2.SelectedIndex + 1
  </code></pre>
  
  <p>But when it reaches the end of the list it gives me an error. How can i let my listbox know that it reached the end.</p>