following code snippet will help us to read the file from local machine.
OpenFileDialog file = new OpenFileDialog(); file.Filter = "Text files (*.txt)|*.txt|All Files(*.*)|*.*"; if (file.ShowDialog() == true)
{
using (StreamReader reader = file.File.OpenText())
{
this.txtFileContent.Text = reader.ReadToEnd();
reader.Close();
}
}
|
No comments:
Post a Comment