Results 1 to 18 of 18

Thread: [RESOLVED] Two listboxes linked togheter

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    91

    Resolved [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!

  2. #2
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Two listboxes linked togheter

    s = List2.List(List1.ListIndex)
    MsgBox s

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    91

    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?

  4. #4
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    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....
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    91

    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

  6. #6
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Two listboxes linked togheter

    but then that's why list2 is hidden? right?
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    91

    Re: Two listboxes linked togheter

    Correct, i need the list2 for shell function and list1 for vision to the user.

  8. #8
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Two listboxes linked togheter

    absolutely... read post 4 again... esp the suggestion part...
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    91

    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?

  10. #10
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Two listboxes linked togheter

    The program launches the first added item to the listbox, Any ideas?
    Show me the code for launching the shortcut...
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  11. #11

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    91

    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

  12. #12
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    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.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  13. #13
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    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?
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  14. #14

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    91

    Re: Two listboxes linked togheter


  15. #15
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    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?
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  16. #16

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    91

    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.

  17. #17
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    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?
    Attached Files Attached Files
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  18. #18

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    91

    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,

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width