473,320 Members | 1,857 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Retrieve Values from a ListBox

Hello, I have this problem,
I have populated a multiselect ListBox, but now I need to retrieve
selected values, and use them as a parameters on the url e.g
http://www.aaa.com/Dynamicpage.aspx?states=(value or values) - which
will be selected from this ListBox, how do I separate multiple values
when they get selected?
Thank you

Jan 12 '07 #1
1 4186
The ListBox class has a method (GetSelectedIndices) which returns an
array of integers which represent the index of items selected.

Info about that method here:
http://msdn2.microsoft.com/en-us/lib...edindices.aspx

for example you can iterate through those items and get the values like
this:
string queryToAppend = null;
foreach( int i in listBoxName.GetSelectedIndices() )
{
string queryToAppend += listBoxName.Items[i].Value;
}
something of that nature.

-Patrick H
http://patpack.blogspot.com/

Jan 12 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Dave Hopper | last post by:
Hi I posted a question recently regarding problems I am having getting a value from a list box to use in a query. I got a lot of help, for which I thank you and it's nearly working! But I need...
2
by: Thomas | last post by:
Hi, I used xsd.exe to generate a *.xsd file from the *.xml-File and then I created a typed DataSet in VisualStudio 2003 But now I have problems to read the data from the DataSet. <?xml...
6
by: Janaka | last post by:
Help! I have two ListBox controls on my web form. The first one gets populated on entry with values from the DB. I then use JavaScript to copy options from this ListBox to my second one. (I...
0
by: Dave | last post by:
Hi all, I have a listbox that is complex bound by an arraylist. The problem is that when I delete an object from the arraylist, the listbox does not reflect those changes. I tried refreshing...
3
by: dfetrow410 | last post by:
I need make a comma seperated list, but whwn I build the list I get a comma at the end. How do I remove it? foreach (ListItem lst in REIPropertyType.Items) { if (lst.Selected == true) {...
2
by: Kodiak | last post by:
I am currently trying to retrieve a certain item in a listbox by passing in the window handle and the string value of the item I am looking for. I know that once I have the window handle of the...
3
by: Kevin Walzer | last post by:
I'm trying to set the active item in a Tkinter listbox to my application's currently-defined default font. Here's how I get the fonts loaded into the listbox: ...
1
by: Intrepid_Yellow | last post by:
Hi, I have the following code that runs my report generator. The user selects a table from a combo box, then whatever fields they want from a list box. (This part all works and the report runs...
1
by: divya | last post by:
Hello, I used the below code to move selected items between two listboxes Left and Right:- <%@ Page Language="C#" AutoEventWireup="true" CodeFile="TestPopup.aspx.cs" Inherits="TestPopup" %> ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.