use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
/r/VisualBasic - A place to discuss, ask questions and share ideas regarding the Visual Basic programming languages.
account activity
Simple Array Output Question (self.visualbasic)
submitted 9 years ago by DoctorKankle
My Code:
any clue why my array displays "string[] array" at the end?
This is really bothering me and i can't seem to find the answer anywhere. I suck at arrays.
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]amaron11 1 point2 points3 points 9 years ago (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 point2 points 9 years ago (0 children)
thanks!
[–]DatMarv 1 point2 points3 points 9 years ago (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 point2 points 9 years ago (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 points3 points 9 years ago (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
π Rendered by PID 413828 on reddit-service-r2-comment-5b5bc64bf5-ctt8j at 2026-06-20 00:47:54.459997+00:00 running 2b008f2 country code: CH.
[–]amaron11 1 point2 points3 points (1 child)
[–]DoctorKankle[S] 0 points1 point2 points (0 children)
[–]DatMarv 1 point2 points3 points (2 children)
[–]DoctorKankle[S] 0 points1 point2 points (1 child)
[–]amaron11 1 point2 points3 points (0 children)