Solved

VB.NET Get Selected Indexes of ListBox on MultiSelection

Posted on 2015-02-07
2
168 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
2 Comments
 
LVL 35

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

705 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now