how can i save the data to a text file after every loop?
<p>I have a for loop (slowed down by a timer) and every second the loop save the date on a text file. but if i close the program before the process ends, the text file remains. </p>

<p>the thing is when i present in class, i will not have enough time to waste waiting for the program to end, and at the same time i need to suspend the thread at sometime so i can't just use a smaller loop and risk not having enough time to suspend and resume.</p>

<p>is there a way to save the file after every loop? so whenever i exit (form based application) i would have some data there?</p>
