Question Initiate external program via List Box?

PiperMp3

New member
Joined
Sep 16, 2014
Messages
1
Programming Experience
Beginner
So I'm writing this program, that allow you to list files from a folder on your own using Open Filedialog.
As of now the program can find .bin and .exe files.

I do also have a code making the program able to label each Extension with a color.

But, I would like the user (either me, or who ever) to be able to start one specific program for each of the filetypes in the listbox.

To explain; When you list the files, there can come a .exe file, or an .bin, or maybe even .txt. Whatever I feel like adding.
Once they are there, I would like to be able to "Doubleclick" a file that might have .txt as extension, then my code will look for one specific program installed on the Client PC or my own named (Example) aroma.exe

On the same time, there will be other files in the List Box, maybe a .bin, but for all .bin files I would like the program aroma2.exe to start.

Since I cannot use a static path (To list the folderpath + programname for each program, as the program can be installed on different locations on other PC's. I can have it on drive D:, but maybe the client-PC got it on C: or A:), is there some way of making my program "search" or try to find this installed aroma.exe program on the machine, and launch it thereafter?

Also that the program/code will recognize the file extension and then link all .txt-files to this aroma.exe, and all .bin to aroma2.exe?

Is this even possible? I've only worked with VB.net for around 2 weeks, and already I'm surprised how much it can do, but I've been stuck for 3 days just for this problem now.

.Bin files - Search/linked to find aroma.exe
.Exe files - Search/linked to find aroma2.exe
ect ect

Current working code for the listbox;

Private Sub ListFiles(ByVal folderPath As String)
    For Each fileInfo In From f In New IO.DirectoryInfo(folderPath).EnumerateFiles _
      Where f.Extension = ".BIN" OrElse f.Extension = ".exe"
              Order By f.Extension
              Select f

        ListBox1.Items.Add(fileInfo.Name)
    Next
End Sub
 
Last edited by a moderator:
Back
Top