Listbox

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".
SETPAsked:
Who is Participating?
 
RonaldBiemansCommented:
I think this

   MsgBox(ListBox1.GetItemText(ListBox1.Items(2)))
0
 
DabasCommented:
Hi SETP:
Have you tried:

ListBox1.Items(2).Text()

Dabas
0
 
RonaldBiemansCommented:
or this works too

MsgBox(ListBox1.Items(2).ToString)
0
 
SETPAuthor Commented:
It was so much simpler in VB6....

PS, ListBox1.Items(2).Text() does not work (one would think it should)
0
 
DabasCommented:
SETP:
It works on a web form. That is what I had open at the time I answered your question!

Dabas
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.