I have a listbox filled with several items. I want my program to go down the list and to each item in the listbox do the same action it did for the one above. The code I have goes down the list but it only performs the action for the first item then just goes down the list not doing the action for the other items.

This is my code:


for (int i = 0; i < numericUpDown2.Value; i++)
{
listBox4.SetSelected(i, true);
listBox4.SelectedItem.ToString();
listBox5.SetSelected(i, true);
createaccount();
}