Open Documents of Arbitrary Type from .Net

  • Thread starter Thread starter Chris Newby
  • Start date Start date
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//
 
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.
 
Dim p As New System.Diagnostics.Process
With p
..StartInfo.RedirectStandardOutput = False
..StartInfo.FileName = YourFileName
..StartInfo.UseShellExecute = True
..Start()
..Dispose()
End With

--
 
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!
 
Back
Top