Last active
February 24, 2020 23:11
-
-
Save Miragecore/e0bc03096248109c1564a2dcce7aece4 to your computer and use it in GitHub Desktop.
OpenFileDialog c#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Windows; | |
using Microsoft.Win32; | |
namespace WpfTutorialSamples.Dialogs | |
{ | |
public partial class OpenFileDialogSample : Window | |
{ | |
public OpenFileDialogSample() | |
{ | |
InitializeComponent(); | |
} | |
private void btnOpenFile_Click(object sender, RoutedEventArgs e) | |
{ | |
OpenFileDialog openFileDialog = new OpenFileDialog(); | |
if(openFileDialog.ShowDialog() == true) | |
txtEditor.Text = File.ReadAllText(openFileDialog.FileName); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment