About
In this code snippet, we will see how to use the Open File Dialog in WFA C# apps.
In this example, I will use a WFA application. If you just want to know how to create/read/write files check out this example with a console application.
When we click the “Open File” button a file dialog will open. After selecting a file the path will get saved in a variable. Then we can either read or write to the selected file. We will be using the StreamWriter class to write to the file and the StreamReader class to read from the file. All these operations need to performed inside a try catch block to prevent the application from crashing if an exception occurs.
Let’s have a look below to see how to implement this.
Code:
[amp-gist id=”f7847a7198fbfbc43517f94e1ee5e3c9″]