Friday, September 15, 2006

Checking and Setting File Types/Associations in .Net 2.0

BlackWasp - Programmatically Checking and Setting File Types

"When developing a Windows Forms application that loads documents, setting custom file types adds greatly to the professional feel of the software. This article explains how to programmatically check your file type is registered and register it if not.

Why Not Register during Set-Up?

Generally the installation package for an application will modify the registry of the end user's Windows installation and set up all of the file types that are required.  This is an ideal place in which to perform this action.  However, it can be problematic should the user accidentally remove or reconfigure the file type.  Also, with Xcopy deployment of software now a viable solution, it is possible that the installation package will never be executed.  In these cases, another solution is required.

..."

This is a nice short and focused article on programmatically setting file associations (i.e. what happens when someone double clicks or right clicks on a given file).

The code snips are in C# but very easily VB.Net'ed (mostly just removing the trailing semi-colon ;)

1 comment:

Anonymous said...

Thanks very much :-)