Community discussion forum

Associating File Types

  • 4 years ago

    I have written a program in VB.Net and it opens a unique file type created by myself.  Can someone tell me how to associate this file type with explorer so that it know to open my program whenever the file is clicked on.  I have read many tutorials for VB 6.0, but haven't had any luck transfering the code to .Net.  Also once the icon is double clicked, I need to store the file path of the file in a string variable.  I would like to know how to do this or maybe to be pointed in the right direction.  Thanks!!

  • 4 years ago
    That information was very useful to me!! Thanks.  Now the other part of my problem is getting the filepath of the file clicked on stored into a string variable inside of the program that is launched.  I have looked at the System.IO and have not been able to find anything to help me out.  I just saw on another website these two lines of code:

    Dim f() As String = System.Environment.GetCommandLineArgs
    Dim sAction As String = f(1).ToLower

    I now know that with the file association it creates a line in the registry that looks like the folowing:

    “c:\MyAppPath\MyApp.exe” “%1”

    Now m question is, does the "Dim f as String()=System.Environment.GetCommandLineArgs" line of code collect the filepath so that I can have the location of the file so I can load it in my program?  Thanks for all help!

Post a reply

Enter your message below

Sign in or Join us (it's free).

Want to stay in touch with what's going on? Follow us on twitter!