Listbox looping driving me loopy!
-
Hi, I've got a bit of niggling problem... - I've got two multi-select listboxes - I want to loop listbox1, and for every item in listbox1 that is selected (by the user), loop listbox2 and find which items are also selected So: Listbox1 --- Item1 Item2 Item3 Listbox 2 --- ItemA ItemB ItemC So my end result should be: Item1 ItemA ItemB ItemC Item2 ItemA ItemB ItemC Item3 ItemA ItemB ItemC However, I can't loop the listboxes. Any suggestions? Thanks
-
Hi, I've got a bit of niggling problem... - I've got two multi-select listboxes - I want to loop listbox1, and for every item in listbox1 that is selected (by the user), loop listbox2 and find which items are also selected So: Listbox1 --- Item1 Item2 Item3 Listbox 2 --- ItemA ItemB ItemC So my end result should be: Item1 ItemA ItemB ItemC Item2 ItemA ItemB ItemC Item3 ItemA ItemB ItemC However, I can't loop the listboxes. Any suggestions? Thanks
for(int i=0;i<n1;i++)
{
if(item "i" of list1 is selected)
{
for(int j=0;j<n2;j++)
{
if(item "j" of list2 is selected)
{
do whatever here
}
}
}
}n1->No. of items in listbox1. n2->No. of items in listbox2. Hope that helps you...
Regards, Arun Kumar.A