I am creating a Windows Form Application and I want the user to be able to open the log file on request, after selecting the option on a menu strip.
I can open the file within notepad but the most recent entries will be at the end of the file. How would I make the application start at the end of the file to save the user a job?
My Current Code:
public static void OpenCurrentLog()
{
Process process = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = Environment.GetEnvironmentVariable("windir").ToString() + "\\system32\\notepad.exe";
startInfo.Arguments = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) +"\\" appName + "\\" + "\\LogFiles\\LogFile.log";
startInfo.WindowStyle = ProcessWindowStyle.Normal;
process.StartInfo = startInfo;
process.Start();
process.WaitForExit();
}
Any Help would be appreciated. I am relatively new to c#.
If you send CTRL (^) - END ({END}) through it will move to the bottom of the notepad file
SendKeys.Send("^{END}");