Run the Application That Owns a File Extension
Problem
You want to launch the application that is registered to handle a specific file type.
Solution
Use the Start method of the System.Diagnostics.Process class.
Discussion
In Visual Basic 6, the only way to execute a program is to directly invoke the executable or use the Win32 API. In Visual Basic .NET, the situation is greatly improved with a specialized Process class that can launch an application based on the file types that are registered with Windows.
The Process class allows you to launch an application such as Microsoft Word (to display .doc files) or Adobe Acrobat Reader (to display .pdf files) without needing to know the exact location of the application on the computer’s hard disk. You simply ...
Get Microsoft® Visual Basic® .NET Programmer's Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.