Explanation:
you can use built-in method ReadAllLines()
of File
class to read the all lines from your file.
Example: System.IO.File.ReadAllLines(filePath);
ReadAllLines()
return the String Array of all lines from file ,so you can store them for later use.
Example : String [] allLines= System.IO.File.ReadAllLines(filePath);
Now take each line from StringArray and assign it to TextBox Control.
Example: textBox1.Text = allLines[0];
Code :
String [] allLines = System.IO.File.ReadAllLines(filePath);
if(allLines.Length > 0)
textBox1.Text = allLines[0];
if(allLines.Length > 1)
textBox2.Text = allLines[1];
if(allLines.Length > 2)
textBox3.Text = allLines[2];