This is simple way to read a text file using c#
first add the namespace system.io
the code is
string line;
try
{
using (StreamReader sr = new StreamReader("configuration.ini"))
{
line = sr.ReadLine();
while (line != null)
{
line = sr.ReadLine();
//do ur validation and code here
}
}
}
catch ()
{
MessageBox.Show("Cannot read from the file");
}
No comments:
Post a Comment