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. Web Development
  3. ASP.NET
  4. Listbox looping driving me loopy!

Listbox looping driving me loopy!

Scheduled Pinned Locked Moved ASP.NET
helpquestion
2 Posts 2 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.
  • A Offline
    A Offline
    Aaron Hudson
    wrote on last edited by
    #1

    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

    A 1 Reply Last reply
    0
    • A Aaron Hudson

      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

      A Offline
      A Offline
      Arun Immanuel
      wrote on last edited by
      #2

      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

      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