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