[RESOLVED] Two listboxes linked togheter
hello, I've got two listboxes which you are able to add programs to, now i want to use the shell command to launch the program.
The thing is that, the list I want to be shown is using Filetitle and the listbox 2 is using FileName.
Now the listbox1 is visible, Listbox2 is not.
If you add a program to Listbox1, The program adds the program to Listbox2 also, but if the user click in the listbox1 nothing happends in listbox2, i think I'll need to use "Index" on the listboxes, but i'm not sure how to do that, so if anyone probably knows that would be great! :)
Re: Two listboxes linked togheter
s = List2.List(List1.ListIndex)
MsgBox s
Re: Two listboxes linked togheter
Thank you very much!! :), another question.. When i take cancel on my common dialog show opens it adds a empty listitem, how do i remove that?
Re: Two listboxes linked togheter
Few questions...
If you are just storing Filetitle and FileName, then how are you planning to launch the program using shell. Why not store the FileName including path in list2
Or one more suggestion... Use two columns in List2. In the first coulmn store the Filetitle which would be the same as list1 and in the 2nd column store the filepath. So when you click on list1, it will search for the Filetitle in list2 and then using shell command execute the path which is stored in the adjacent cell...
Just a thought....
Re: Two listboxes linked togheter
koolsid, Thanks for that.
But, if the user sees two lines of the same program there will be a confusion, because you can't stylize the listbox enough to make it clear for the users needs.
Or if you know something about how to make that, I would be glad if you sended it here :)
Re: Two listboxes linked togheter
but then that's why list2 is hidden? right?
Re: Two listboxes linked togheter
Correct, i need the list2 for shell function and list1 for vision to the user.
Re: Two listboxes linked togheter
absolutely... read post 4 again... esp the suggestion part...
Re: Two listboxes linked togheter
Thank you koolsid, It worked :)
But there's another problem.
If i add 2 shortcuts in the listbox, and try to launch. The program launches the first added item to the listbox, Any ideas?
Re: Two listboxes linked togheter
Quote:
The program launches the first added item to the listbox, Any ideas?
Show me the code for launching the shortcut...
Re: Two listboxes linked togheter
Code:
If List1.Selected(intListX) Then
Shell (CD.FileName)
End If
That's the code.
2 errors:
(1) If i add 2 shortcuts to my list, the program launches the latest added file not the selected one.
(2) If i take cancel on the Commondialog.showopen it still adds a new shortcut
Re: Two listboxes linked togheter
You changed the columns to 2 in your hidden listbox? Can you show us the code you used to add a new item(s) to your listbox. I think there might be some confusion there.
What is CD? common dialog? I thought you were storing the paths in your hidden listbox, shouldn't you be shelling that? More clarification would be helpful.
Re: Two listboxes linked togheter
If I assume that CD is the Commondialog then where are you launching the shortcut?
Would it be possible to upload your file?
Re: Two listboxes linked togheter
Re: Two listboxes linked togheter
I guess you are using some ocx developed by keith (lavolpe)? Also I don't see a second listbox here...
Sorry I got totally confused with your code... Let's start from the scratch...
What are you exactly trying to do here?
Re: Two listboxes linked togheter
Koolsid, you're completely right about the lavolpe buttons, why i removed them was because, I can't be sure that you have that OCX in your computer and would get an error just for that.
Second, If you open my project there you'll see ONE listbox, (I removed the other because i didn't need that because the shell didn't need to be shelled from Commondialog.Filename, Which i thought)
And you'll see three buttons.
If you press ADD a showOpen will be shown, and you can only select .exe files.
And remove button to remove .exe files from the list
And the Launch, to use the shell the list object.
When i press cancel on showopen when i press add, the program adds a list object anyway.
And if i add 2 objects to my list, the project won't shell the selected file, just the latest added file to the listbox.
1 Attachment(s)
Re: Two listboxes linked togheter
There were plenty of errors in that so I created a new file using your form. I have added another listbox which is hidden. You can resize the form to see it...
I have updated the project... Hope this is what you wanted?
Re: Two listboxes linked togheter
Koolsid, If i believed in god, I would make a prayer for you right now.
Can't find anywords.. This is EXACTLY what i want it to be like. Thank you so so... So so so so much!!!! :)
Over and out, :wave: