Try something like this
var openDialog = new OpenFileDialog();
if (openDialog.ShowDialog == DialogResult.OK)
{
using (var stream = File.OpenRead(openDialog.FileName)
{
//read everything here
}
}
More Related Contents:
- OpenFileDialog is not opening the file [closed]
- How do I use OpenFileDialog to select a folder?
- Open file dialog and select a file using WPF controls and C#
- Select either a file or folder from the same dialog in .NET
- Customizing OpenFileDialog
- Adding or subtracting color from an image in a pictureBox using C#
- OpenFileDialog can’t load CSV files but can load xls/xlsx Excel files [duplicate]
- C# – How to customize OpenFileDialog to select multiple folders and files?
- C# OpenFileDialog Non-Modal possible
- WPF OpenFileDialog with the MVVM pattern? [duplicate]
- Obtaining only the filename when using OpenFileDialog property “FileName”
- C# OpenFileDialog Lock To Directory
- File Upload ASP.NET MVC 3.0
- Non-unique enum values
- Get properties in order of declaration using reflection
- Extracting mantissa and exponent from double in c#
- How can I use EnumWindows to find windows with a specific caption/title?
- convert double to int
- .NET ObservableDictionary
- redirecting output to the text file c#
- Which blocking operations cause an STA thread to pump COM messages?
- WCF Service Client: The content type text/html; charset=utf-8 of the response message does not match the content type of the binding
- multiple JsonProperty Name assigned to single property
- A reproducible example of volatile usage
- Multiple Controller Types with same Route prefix ASP.NET Web Api
- Could not load file or assembly ‘Microsoft.CodeAnalysis, version= 1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependenc
- Http Post for Windows Phone 8
- Access to disposed closure in C#?
- How can I get the values of the parameters of a calling method?
- How do I safely store database login and password in a C# application?