Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Show subitems of an item in listbox

Show subitems of an item in listbox

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    VishnuKalyani
    wrote on last edited by
    #1

    Hi, I have two list boxes ( ListBox1 and ListBox2 ) and an EditBox ( Edit1 ) box. 1. Select an item in ListBox1. 2. Enter a string in EditBox and Press Enter Key. 3. The String will go to ListBox2. 4. Like that add any number of items by selecting an item in ListBox1. Problem : When we select an item in ListBox1, ListBox2 should display all the items we entered under ListBox1 dynamically. How I can achieve this ?

    It's kind of fun to do the impossible.

    N V 2 Replies Last reply
    0
    • V VishnuKalyani

      Hi, I have two list boxes ( ListBox1 and ListBox2 ) and an EditBox ( Edit1 ) box. 1. Select an item in ListBox1. 2. Enter a string in EditBox and Press Enter Key. 3. The String will go to ListBox2. 4. Like that add any number of items by selecting an item in ListBox1. Problem : When we select an item in ListBox1, ListBox2 should display all the items we entered under ListBox1 dynamically. How I can achieve this ?

      It's kind of fun to do the impossible.

      N Offline
      N Offline
      nguyenvhn
      wrote on last edited by
      #2

      Create in memory a data structure to store all items in Listbox2 associated with each item in Listbox1. A dictionary or hashing table will be appropriate. When adding an item to listbox2, again adding it to that data structure. When selected item in listbox1 changed, reload all items associated with listbox1 selected item to listbox2. Hope that helps

      1 Reply Last reply
      0
      • V VishnuKalyani

        Hi, I have two list boxes ( ListBox1 and ListBox2 ) and an EditBox ( Edit1 ) box. 1. Select an item in ListBox1. 2. Enter a string in EditBox and Press Enter Key. 3. The String will go to ListBox2. 4. Like that add any number of items by selecting an item in ListBox1. Problem : When we select an item in ListBox1, ListBox2 should display all the items we entered under ListBox1 dynamically. How I can achieve this ?

        It's kind of fun to do the impossible.

        V Offline
        V Offline
        VCSharp007
        wrote on last edited by
        #3

        Think about using a collection class for storing the data(CMap will be better choice).. Put the item in list1 as "Key" and the items corresponding to it in List2 as "value"(use CStringArray here).

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups