Click here to Skip to main content
15,896,111 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to link two list box where one list box has list of items like fruits, flowers,vegetables. and second list has mango,orange,rose,tulip,lotus,sunflower,apple,cucumber,tomato.

When i select fruit in one list only fruits should be shown in the other list and when i select vegetables only vegetables(cucumber,tomato) should be listed in another list.

How to link such list?
Posted
Updated 22-Feb-12 20:53pm
v6

C++
CString str1;
	int Patch = m_grp_Inst.GetCurSel();
	m_grp_Inst.GetText(Patch,str1);
if(str1="fruits")
{
m_gmList.AddString("Mango");
}

using this i have got string in str1 and based add string to the another list
 
Share this answer
 
v2
The idea is to write code for this.


Handle the item select event of list1 and populate list2 based on the selected item in list1.
 
Share this answer
 
Comments
chaiein 23-Feb-12 2:10am    
how to get the selected item string in vc++9.0
chaiein 23-Feb-12 2:35am    
CString str1;
int Patch = m_grp_Inst.GetCurSel();
m_grp_Inst.GetText(Patch,str1);

if(str1=="fruits")
{
//What is the code???
}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900