I want to be able to display data from .txt file up into a richtextbox.
This is the code I have at the moment:
- private void getDetails()
- {
-
- string Path = $@"Z:\IT\Shares\PC\DA-0123\SD\SDD\DataFile.txt";
- if (File.Exists(Path))
- {
- var data = File
- .ReadAllLines(Path)
- .Select(x => x.Split('='))
- .Where(x => x.Length > 1)
- .ToDictionary(x => x[0].Trim(), x => x[1]);
- using (StreamWriter tw = File.AppendText($@"Z:\IT\Shares\PC\DA-0123\SD\Files\SysLog.txt"))
- {
-
- tw.WriteLine("Details..\n");
- tw.WriteLine("Name: {0}", data["Name"]);
- tw.WriteLine("Emp ID: {0}", data["Emp ID"]);
- tw.WriteLine("---------------------------------------------\n");
- }
- }
- }