Code to read the text file and display in label using C#

Karthikanbarasan
Posted by Karthikanbarasan under C# category on | Points: 40 | Views : 10062
string strfilename = "put your path here";
StreamReader sr = new StreamReader(strfilename);
try
{
while (sr.Peek() >= 0)
{
string strRead = sr.ReadLine();
label1.text = strRead.Tostring();
}
}
finally
{
sr.Close();
}

Comments or Responses

Login to post response