using Microsoft.Practices.EnterpriseLibrary.Logging;
private voidbtnReadFile_Click(object sender, EventArgs e)
{
StreamReader sr =null;
try
{
sr =newStreamReader(txtFilePath.Text);
txtFileContent.Text = sr.ReadToEnd();
}
catch (FileNotFoundException)
{
txtFileContent.Text="Exception details logged log file
and Event Viewer";
LogEntry objLog = new LogEntry();
objLog.Message = "Please provide valid Filename";
objLog.Categories.Add("File Read Error");
Logger.Write(objLog);
}
finally
{
if (sr != null)
{
sr.Close();
}
}
}