opening files in their native progras and applications in vb.net

Posted on 2009-04-17
Medium Priority
Last Modified: 2013-11-08

I'm planning to incorporate in my application a tool to allow the user to brows for files and then save the file name and path to a table. (sort of attaching a file).  Later I will be loading the saved file names with their path into a listbox. The files can be Excel and Word documents to image files etc...

My question: What is the best way to allow the user to launch these files in their native applications? Is there a way to hyperlink the entire path?

Question by:mkarkoukli
  • 2
  • 2

Author Comment

ID: 24170827
I will be using MS SQL 2005
LVL 64

Accepted Solution

Fernando Soto earned 2000 total points
ID: 24171483
Hi mkarkoukli;

You can use the Process class to do this. In the code snippet I have a file MyFile.csv located in the C:\Temp directory. When this information is passed to the Process.Start function as shown below the system will start Microsoft Excel.

Dim filename As String = "C:\Temp\MyFile.csv"

The system looks at the extension of the file and looks up the native program associated with that extension and starts that program passing in the file to open.


Author Closing Comment

ID: 31571597
Thank you Fernando, I will give it a try
LVL 64

Expert Comment

by:Fernando Soto
ID: 24173438
Not a problem, glad I was able to help.  ;=)

Featured Post

Granular recovery for Microsoft Exchange

With Veeam Explorer for Microsoft Exchange you can choose the Exchange Servers and restore points you’re interested in, and Veeam Explorer will present the contents of those mailbox stores for browsing, searching and exporting.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Integration Management Part 2
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question