Reading Values from multiple ListBoxes and forming an query
-
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
-
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
That really a fairly simple problem. You can get one or multiple values using
ListBox.SelectedItems
. Enumerate that property collection to get values. For eachListBox
, 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]