Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open HTML file in browser in WPF application

Tags:

c#

file

wpf

My applicattion is WPF: I want to open the local file help.html of my project in the default browser. I have created a button Help, in the event I want to open this .html.

I have some problems with the path... Thanks.

like image 953
David Avatar asked Dec 19 '25 16:12

David


2 Answers

You can open any file with your default program using System.Diagnostics.Process.Start method.

But before you have to open your file, you must be included in the application folder for this, you can click right on the file go -> properties and the properties box, select Copy if newer on the property Copy to Output Directory.

Put the below code in your button click event:

System.Diagnostics.Process.Start("help.html");
like image 147
Nicolas Dias Avatar answered Dec 23 '25 13:12

Nicolas Dias


Use below code in button_Click event

System.Diagnostics.Process.Start("your HTML File Path");
like image 26
Arshad Avatar answered Dec 23 '25 15:12

Arshad



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!