title: How to not select same item on listbox which is selected before
body: <p>Currently im trying to make a mp3 player. I have a checkbox which is called 'play songs randomly'. And a listbox full of songs. My question is that i dont want to play same song if its selected once. How do i do this?
  i am using the following code:</p>
  
  <pre><code>Random rnd = new Random()
      private void btnnext_Click_1(object sender, EventArgs e)
      {
          if (checkBox1.Checked)
          {
              int number = rnd.Next(0, listBox1.Items.Count - 1);
              listBox1.SelectedIndex = number;
              play();
          }
  </code></pre>
  
  <p>And one last thing: i can't select the last index of listbox if checkbox is checked. it never selects last index. how can i fix this?</p>