Link to home
Start Free TrialLog in
Avatar of SETP
SETP

asked on

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".
Avatar of Dabas
Dabas
Flag of Australia image

Hi SETP:
Have you tried:

ListBox1.Items(2).Text()

Dabas
ASKER CERTIFIED SOLUTION
Avatar of RonaldBiemans
RonaldBiemans

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RonaldBiemans
RonaldBiemans

or this works too

MsgBox(ListBox1.Items(2).ToString)
Avatar of SETP

ASKER

It was so much simpler in VB6....

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

Dabas