4
Answers

Monitoring a text file with C#

nam.tran

nam.tran

20y
2k
1
I'd like to be able to 'monitor' a text file that gets constantly appended to by another application so that I can use the updated text from the text file in my C# application whenever it does get updated. Any suggestions on how to do this?
Answers (4)
0
Vulpes
NA 98.3k 1.5m 11y
Try this code:

private void Form1_KeyDown(object sender, KeyEventArgs e)
{
   pressed = true;
   label1.Text = "Key Pressed: " + e.KeyCode;
   timer1.Stop();
   timer1_Tick(timer1, EventArgs.Empty);
   timer1.Start();
}