Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Starting application from data file

When you double-click on a Word document, Word is automatically run and the document is loaded.

What steps are needed to do the same thing with my C# application?

In other words, assume my application uses ".XYZ" data files. I know how to tell Windows to start my application when a .XYZ data file is double clicked. But how do I find out within my application what data file was chosen so I can load it?

like image 357
Mark T Avatar asked Jan 29 '26 04:01

Mark T


1 Answers

Granted this is a VB.NET solution, but this article has details on how to create the file association for your application in the registry and how to retrieve the command arguments when your application is fired up to do the proper file handling.

It looks easy enough to port over to C#.

like image 83
Dillie-O Avatar answered Jan 31 '26 18:01

Dillie-O



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!