Donate

Process.Start() Error - An error occurred trying to start process. The specified executable is not a valid application for this OS platform.

Good evening!

I had an issue when opening PDF files using Process.Start() which is called in a ShowFile() method of the project. The code which isn't working is shown below.
System.Diagnostics.Process.Start(Path.Combine(myDocumentsPath, fileName));
The solution for that is to pass a ProcessStartInfo() object in the Start() parameter. And then set UseShellExecute property of the ProcessStartInfo object to true. The modified code that is working is shown below.
System.Diagnostics.Process.Start(new ProcessStartInfo(Path.Combine(myDocumentsPath, fileName)) { UseShellExecute = true });
Output

Comments

Donate

Popular Posts From This Blog

WPF CRUD Application Using DataGrid, MVVM Pattern, Entity Framework, And C#.NET

How To Insert Or Add Emojis In Microsoft Teams Status Message

Bootstrap Modal In ASP.NET MVC With CRUD Operations