I am creating a program in vb.net, and I want to set my application as the default application for a given file extension - for example, .txt
.
How can I accomplish this?
I found a simple way to associate files by vb.net (from CodeProject, link: http://www.codeproject.com/Articles/18594/File-Association-in-VB-NET)
The code is:
My.Computer.Registry.ClassesRoot.CreateSubKey(".rtf").SetValue("", "Rich Text File", Microsoft.Win32.RegistryValueKind.String)
My.Computer.Registry.ClassesRoot.CreateSubKey("Rich Text File\shell\open\command").SetValue("", Application.ExecutablePath & " ""%l"" ", Microsoft.Win32.RegistryValueKind.String)