Reputation: 3328
Hi I have a textbox and a button named browser. When I click the browser button, my program uses the Microsoft.Win32.OpenFileDialog to display the file name I selected on the textbox. If I want to add one more button named open, when I click open button, the above file could be opened. No matter it's a *.cs file, *.txt or *.xml. Is this possible? I try to use OpenFileDialog.OpenFile(), doesn't work. Thanks!
Upvotes: 0
Views: 696
Reputation: 32629
You can use System.Diagnostics.Process.Start
it will use whatever is your default program to open the file, like this:
System.Diagnostics.Process.Start(filePath);
Upvotes: 1