I have a file that gets copied every second over network to update a txt file located at c:\folder\data.txt.
The txt file contains data like:
Code:
name
serial
in
out
test
All in a row. Currently I am using VB code to pull from this file into excel. I would like to pull this into C#. What is the best way to approach this? I have to use the offset command in VB to get the data set in the proper cells.
I see two boxes of code. None that specify where the txt file actually resides. Also I need this in form view or any clean view to display on a monitor. A console window will not work.
StreamReader("TestFile.txt") - This means the file is in the same directory with application.
In Windows Forms you can select file with OpenFileDialog.
In the example with open file dialog you have how to read content from file and put in stream. At the bottom you have and RichTextBox for displaying results.