Keanu Lorenzo Keanu Lorenzo - 1 year ago 79 Question

Make custom file open by a custom program VB

How to make a file (

extension for example) that when you open it, your custom program will pop-up.

For example:

I have a

If i double-click it, my program will be the one to read it.

Just like a .jpg file extension, when double-clicking the file, paint will pop-up and shows the image.

My code when changing the file ext is just simple

File.Copy(origFile, origFile.Replace("txt", "jkl")

So now i have a
file, now what I need to do is when the user double clicks the
file, this program will automatically open, ask where to save it, and change it back to
to the path where the user wants to.

How can I do this?

Answer Source

Put it the form load event. it will write again and again. It won't destroy your PC. If you want to more carefully. Read registry check if it is exist then skip write again.


    ("", "jkl", Microsoft.Win32.RegistryValueKind.String)
    ("jkl\shell\open\command").SetValue("", Application.ExecutablePath & _
    " ""%l"" ", Microsoft.Win32.RegistryValueKind.String)

link for demo project:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download