C# open up an given file using given program

  • 14 years ago

    Hi,  I am trying to write a program which can open up any file and allowing user to pick which program to use to open. e.g open up "mr.eml" using outlook express.

    But Currently I have no idea how I can do it in c#. Can anyone help me with that?

  • 14 years ago

    first off , get the user to select a fill either by showing lists of files and folder http://www.developerfusion.co.uk/show/4359/ or by using the OpenFileDialog component, then use System.Diagnostics.Process to launch the file : example :

    http://msdn2.microsoft.com/en-us/library/system.diagnostics.process.aspx

  • 14 years ago

    Hi,

    Ttry using "ProcessStartInfo" class. This class provides you lots of proerties to specify the executable(to be launched) with and without arguments(parameters to be passed for starting a new process) and the also the style (e.g. window size, parent process, user authentication) for the process being sarted.

    Hope this helps

    Ankit 

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“A computer lets you make more mistakes faster than any other invention in human history, with the possible exceptions of handguns and tequila” - Mitch Ratcliffe