Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
string file = "c://test.txt"; // The file's full path
System.IO.StreamReader sr = new System.IO.StreamReader(file);
string[] contents ={ }; // Hold the data
long rows = 0;
while (sr.Peek() != -1)
{
sr.ReadLine();
rows++;
}
// Suppose that 100 lines (rows/records) are ok.
if (rows != 100)
MessageBox.Show("Invalid file...");
else
{
// Go to the start
sr.BaseStream.Seek(0, System.IO.SeekOrigin.Begin);
contents = new string[100];
int i = 0;
while (sr.Peek() != -1)
contents[i] = sr.ReadLine();
}
sr.Close();
sr = null;
// All data are in 'contents [0 - 99]' array
// Go on from here !