I am writing a program that is used to merge data from two different file types; a JBX and a JBN file. In the program there a two list boxes, one to hold the JBX file and one for the JBN. I wanted to add the ability that if a user goes into a folder, selects multiple JBX and JBN files, and opens then, the program would automatically start up and put the file into there appropriate columns. I tried the following code:
- Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
-
-
Dim param As String
-
-
-
For Each param In System.Environment.GetCommandLineArgs
-
-
MsgBox(param)
-
-
If param.Substring(param.Length - 3, 3).ToLower = "jbx" Then
-
lstJBX.Items.Add(Path.GetFileNameWithoutExtension(param))
-
ElseIf param.Substring(param.Length - 3, 3).ToLower = "jbn" Then
-
lstJBN.Items.Add(Path.GetFileNameWithoutExtension(param))
-
End If
-
-
Next
-
-
End Sub
I added the MsgBox code so that when I ran the program I would be able to see the arguments that were being passed to the program. However, if I select 3 JBX file and 3 JBN files and try to open them, the first message box that appears is the full path of the program which obviously isn't put in one of the list boxes because it has an EXE extension. The second message box that appears is only the full path of the first file (out of the 6) that I selected. It is put into the correct listbox, but it seems that the paths of the other five files are not being passed to the program and I can't figure out why.
The effect I'm trying to achieve is similar to that of Winamp or Window Media Player, in that you select multiple files from outside the program and the program will load and place the names of the files (without the paths) into a playlist (in my case a list box).
Any comments or help will be greatly appreciated. I am running MS VS 2005 Professional Edition on Windows XP SP2.
Thanks,
Dominick