C# InvalidArgument=Value of '1' is not valid for 'index'
<p>I get the following error:</p>
<blockquote>
<p>An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in System.Windows.Forms.dll</p>
<p>Additional information: InvalidArgument=Value of '1' is not valid for 'index'</p>
</blockquote>
<p>For the following code.</p>
<pre><code>private void button_confirm_Click(object sender, EventArgs e)
    {
        listBox_savedata.Items.Add(textBox_ordertostart.Text +&quot; &quot;+ comboBox_suburb.SelectedItem.ToString() + &quot; &quot; + dateTimePicker2.Value.ToShortDateString());
     
        
            for (int i = 0; i &lt;= listBox_savedata.Items.Count; i++)
            {
                string s1 = listBox_savedata.Items[i].ToString();
                int startpos = s1.IndexOf(&quot;PM&quot;);
                string sub = s1.Substring(0, 5);
                if(sub+&quot; &quot;+&quot;PM&quot;==DateTime.Now.ToString(&quot;HH:mm tt&quot;))
                    { 
                    mplayer.PlayLooping();
                
            }
        }
    }
</code></pre>