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#
  4. Reading Values from multiple ListBoxes and forming an query

Reading Values from multiple ListBoxes and forming an query

Scheduled Pinned Locked Moved C#
questiondatabasehelp
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
    abhishk2001 yahoo com
    wrote on last edited by
    #1

    Hi, I have a Windows Form, which has multiple ListBoxes, being populated by data on FormLoad Event, and a Button to run the query. onClick of the button, I want to get all the selected values from the ListBoxes and form a Query String, with commas in between values, How can i Do That ?? Any help is appreciated. Thanks, Abhi

    H 1 Reply Last reply
    0
    • A abhishk2001 yahoo com

      Hi, I have a Windows Form, which has multiple ListBoxes, being populated by data on FormLoad Event, and a Button to run the query. onClick of the button, I want to get all the selected values from the ListBoxes and form a Query String, with commas in between values, How can i Do That ?? Any help is appreciated. Thanks, Abhi

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      That really a fairly simple problem. You can get one or multiple values using ListBox.SelectedItems. Enumerate that property collection to get values. For each ListBox, you do this again. How you construct the query is up to you, but string concatenation, String.Concat, StringBuilder.Append, and many other ways can help you. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles]

      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