Executing an external file from C#

Hello everyone again!

Thanks for the help on the last problem I was running into!

This time around, I am trying to execute a file from my code based on its filetype.

What I have done is:

1) Given a path, I have loaded the information into a byte array
2) Saved a referrence to the file into a database

Now, given the referrence, I need to

1) execute the file in its default viewer, ex:
.doc = Launch Microsoft Word
.pdf = Launch Adobe Acrobat Reader
.txt = Launch NotePad

And so on.....so given the path of the file, I just want to execute it with its default application.

Anybody point me to the right method or class to execute the file object?

Thanks!

Tree

[699 byte] By [codefund.com] at [2007-12-16]
# 1
System.Diagnostics.Process.Start()

Look into the System.Diagnosotics.Process namespace...

It has some good stuff in it.

Just a thought

codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 2
Check out the System.Diagnostics.Process.Start method. You can pass in a filename and it will launch the associated application and load the file.

-Karl Erickson

codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 3
Great!

Thanks everyone!

(Viking/Karl, that is :))

codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,Windows Forms General...