VB.net display each item of a List

Murray Brown
Murray Brown used Ask the Experts™
on
Hi. In VB.net, if I use the following code to create a list, what code would I use to
loop through the code and show each item in a MsgBox?

Dim aList As New System.Collections.Generic.List(Of String)()

aList.Add("one")
aList.Add("two")
aList.Add("three")
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
Try:

For each sItem as String in aList
    msgbox(sItem)
Next

Open in new window

Commented:
Do:
MessageBox.Show(Join(aList.ToArray, vbCrLf))

Open in new window

Murray BrownASP.net/VBA/VSTO Developer

Author

Commented:
thanks very much

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial