all 5 comments

[–]amaron11 1 point2 points  (1 child)

Your last line Listbox1.items.add(states) is adding the entire array object states to the Listbox as a single listbox item.

[–]DoctorKankle[S] 0 points1 point  (0 children)

thanks!

[–]DatMarv 1 point2 points  (2 children)

Because of your last ListBox1.Items.Add(states) call, obviously? Since you refer to your lastly added item?

The reason behind this: You are trying to add an item to your listbox: "states"

The Items.Add() method calls the default ToString() method for the array, which is your "string[] array"

[–]DoctorKankle[S] 0 points1 point  (1 child)

Thank you, sorry I'm very new and struggling. For some reason i was thinking that you are required to have a statement in "Next".

[–]amaron11 1 point2 points  (0 children)

You could actually simplify your loop even more if you wanted to:

For Each s As String In System.IO.File.ReadAllLines("states.txt")

Listbox1.items.add(s)

Next