Solved

VB.NET Get Selected Indexes of ListBox on MultiSelection

Posted on 2015-02-07
2
197 Views
Last Modified: 2015-02-07
How do you loop through and get the index of the listbox of each item selected?  Haven't found a clear example.  All examples I've found get me the text and I want the numerical value as I need to pass that to an array to pull some value.
0
Comment
Question by:CipherIS
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 36

Accepted Solution

by:
Miguel Oz earned 500 total points
ID: 40596348
If  you require this task for a Win form App, you can use: listbox's selectedindices property.
then you can convert this collection property to an integer array or use it directly.
0
 
LVL 1

Author Comment

by:CipherIS
ID: 40596368
That link helped which got me to this

 For Each Index In ListBox1.SelectedIndices
            TextBox2.Text &= Index.ToString() & " "
Next

Open in new window


I found it at this link
http://www.java2s.com/Tutorial/VB/0260__GUI/GetselectedindicesinaListBox.htm
0

Featured Post

Learn by Doing. Anytime. Anywhere.

Do you like to learn by doing?
Our labs and exercises give you the chance to do just that: Learn by performing actions on real environments.

Hands-on, scenario-based labs give you experience on real environments provided by us so you don't have to worry about breaking anything.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question