spspli
spspli

Reputation: 3328

how to open a file and edit it in wpf

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

Answers (1)

Aviad P.
Aviad P.

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

Related Questions