O'Reilly logo

Microsoft® Visual Basic® .NET Programmer's Cookbook by Matthew MacDonald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required