Show subitems of an item in listbox
-
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.
-
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.
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
-
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.
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).