C# - Using Console.
I need to implement delays between the writing of consecutive lines.
Other than nested for loops, is it anything easier much as a Timer for forms?
I want to control the duration of those delays.
Could anyone show a sample of code?
Gracias.
Ryan AlfordPosted Jan 1, 2009, 1:07 PM
Agustin FerrariPosted Jan 10, 2009, 5:51 AM
Jan,
I managed to understand the basics of timers I could use with Console.
Gracias for that code.
Jan MontanoPosted Jan 5, 2009, 11:06 PM
Console.WriteLine("A");
Thread.Sleep(1000); // delay of 1000 milliseconds or 1 second.
Console.WriteLine("C");
for (int i=0; i<10; i++)
{
Console.WriteLine(stringarray[i]);
Thread.Sleep(10000); // delay of 10 seconds.
}
Thread.Sleep(0); // infiinte delay.
Agustin FerrariPosted Jan 4, 2009, 7:12 AM
I am far from my PC so no chance to show that snippet for a while.
Could you explain how to use Timers.Timer and Threading.Timer to obtain a delay used once or for repetitive actions that I could stop or leave going forever?
Jan MontanoPosted Jan 1, 2009, 7:29 PM
Agustin FerrariPosted Jan 1, 2009, 7:08 PM
I managed to have a working snippet just by tweaking an example. But found no proper complete explanation on how to use it.
Could you elaborate a little? Events for forms are not in my area of interest.
Gracias.