I have a foreach loop that I need to pause in order to allow user input on the form.
foreach (XmlNode node2 in xmlFile)
{
...get currentRow from XML file
...update form label
???wait for user to enter data on form and press button
}
Is there any sort of wait-for-user-input function in C# that I can use to do this?
UPDATE:
Based on the feedback I have successfully modified the program to:
- Load the XML list into a Queue (using the ForEach loop)
- Setup the user input to iterate through the Queue (remove top item, show next top item)
You can open a modal form where the user can make the input.
If you want to stay on the same form all the time you better copy all nodes to an
Queue<XmlNode>, process one at a time and when the user presses the button pick the next item in the Queue until the queue is empty.