?
Solved

Listbox

Posted on 2005-04-06
5
Medium Priority
?
266 Views
Last Modified: 2011-05-22
If I want to get the text i a listbox in, lets say, index 3. How do I do that? So that if I have a ListBox with 5 items:

"Item 1"
"Item 2"
"Item 3"
"Item 4"
"Item 5"

And I want to get the 3rd item, it should return the text "Item 3".
0
Comment
Question by:SETP
  • 2
  • 2
5 Comments
 
LVL 27

Expert Comment

by:Dabas
ID: 13715064
Hi SETP:
Have you tried:

ListBox1.Items(2).Text()

Dabas
0
 
LVL 25

Accepted Solution

by:
RonaldBiemans earned 2000 total points
ID: 13715157
I think this

   MsgBox(ListBox1.GetItemText(ListBox1.Items(2)))
0
 
LVL 25

Expert Comment

by:RonaldBiemans
ID: 13715200
or this works too

MsgBox(ListBox1.Items(2).ToString)
0
 

Author Comment

by:SETP
ID: 13715303
It was so much simpler in VB6....

PS, ListBox1.Items(2).Text() does not work (one would think it should)
0
 
LVL 27

Expert Comment

by:Dabas
ID: 13715325
SETP:
It works on a web form. That is what I had open at the time I answered your question!

Dabas
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Integration Management Part 2
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

809 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