Open Documents of Arbitrary Type from .Net

C

Chris Newby

I'm developing a win form based add-on to a document management system using
the .Net runtime. When a user is using my add-on they could be dealing with
documents of many different types, e.g. Word, PDF, Excel, RTF. I would like
to add a "View" button to my add-on that will open whatever document they
are currently handleing with that document's associated application.

I'm not trying to control the document after that point; I simply want to
launch the associated application and forget about it.

What's the best way? Any thoughts?

TIA//
 
B

Bob Powell [MVP]

If you use the process class to run the file that you're interested in such
as "MyPDF.PDF" the normal file associations will kick in and display the
file in whatever program is assigned to that file.

I've also created viewers before that launch the associated program inside
the IE browser control. This is a good container.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
G

George Shubin

Dim p As New System.Diagnostics.Process
With p
..StartInfo.RedirectStandardOutput = False
..StartInfo.FileName = YourFileName
..StartInfo.UseShellExecute = True
..Start()
..Dispose()
End With

--
 
C

Chris Newby

Awesome ...

Yeah ... I was trying the process class, but was having problems and wasn't
sure it was the right way to go. I'll try it again tho//

Thanks everyone!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top