Associate text file to open with my application RRS feed

  • Question

  • I am trying to associate the text files to open with my application but when I click on a text file then it give  me this error.


    This is the code i use

    Public Sub ChecAssocation()
            My.Computer.Registry.ClassesRoot.CreateSubKey(".txt").SetValue("", "Mdlabs_Text_editor", Microsoft.Win32.RegistryValueKind.String)
            My.Computer.Registry.ClassesRoot.CreateSubKey("Mdlabs_Text_editor\shell\open\comand").SetValue("", "C:\Program Files\mdlabs_text_editor\editor_de_texto.exe" & " ""%1"" ", Microsoft.Win32.RegistryValueKind.String)
            My.Computer.Registry.ClassesRoot.CreateSubKey("Mdlabs_Text_editorDefaultIcon").SetValue("", "C:\Program Files\mdlabs_text_editor\" & "\my new icon for apps.ico")
        Catch ex As Exception
        End Try
    End Sub

    Tuesday, October 30, 2018 5:11 PM

All replies

  • Delete the keys you added to the registry.

    Right Click on any text file and choose "Open With", then "Choose another app", find your prog, and assign   it. Make sure it works every time.

    Look in the registry to see what changes were made, and use those in your code.

    This is my registry for ".txt"
    Windows Registry Editor Version 5.00
    "Content Type"="text/plain"
    The Item Name part is HEX Unicode for:

    • Edited by Devon_Nullman Tuesday, October 30, 2018 5:23 PM addition
    Tuesday, October 30, 2018 5:18 PM
  • Tank you for replay i have try like you have say, and i have export the key user choice but it give me an error wen i try to apply it.

    Tuesday, October 30, 2018 5:25 PM
  • How can i change this line to  open with my app


    this will bee the full path for my app

    C:\Program Files\mdlabs_text_editor\editor_de_texto.exe

    Tuesday, October 30, 2018 5:47 PM