Hello, first this is not a homework assignment so please respond whenever you have time as a speedy solution is not exactly needed. I have been learning C# recently from a microsoft book and had an idea of a program i want to make. Basically i want to be able to read a text file, then after reading it line by line send the lines somewhere else WITH a time delay. Here is where i have stalled. I do not know how to send the text, then wait lets say 20 sec, then send the next line and so on.So what i looking is for for code snippets or something which deals with this. Here is what i have tried so far using timer.
private void timer1_Tick(object sender, EventArgs e)
{
while ((line = file.ReadLine()) != null)
{
textToSend ="{Enter}" + line + "{Enter}";
textBox1.AppendText(textToSend);
SendKeys.Send(textToSend);
}
}
basically there is my timer method which reads line from a file i have already opened. Makes a new string with {Enter} start and end. Which means that it will send the string in the window if we have focus.I plan to add a hotkey for that later. What i want to do now in this while loop is wait 30 sec after each line is read and then send the next line.
In another method which i call i have these two lines which i think will do what i want them to do.
public void start()
{
timer1.Interval = 10000;
timer1.Start();
}