Hate to ask this but where am I going wrong?
public void foo(object sender, EventArgs e)
{
List<Label> exerciseLabels = new List<Label>();
string tempExercise = exerciseTextBox.Text;
int numExercises = 0;
day[tempDay].addExercise(numExercises, tempExercise);
exerciseLabels.Add(new Label());
exerciseLabels[1].Text = string.Format("{0}. {1}", numExercises + 1, tempExercise);
}
I am receiving an argument is out range.
Thanks in advance.
lists are 0-based; should be
exerciseLabels[0]for the first item. Or better still:no need to access the indexer.