How do I add a line like "hello" to a listbox in vb.net?

How do I add a line like "hello" to a listbox in vb.net?

lbUsers.add("Jessie")

something like that?
HepenAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

LordWabbitCommented:
would probably be more like listbox1.Items.Add("hello") a lbl is usually short for label which when then be lblUsers.Text
0
HepenAuthor Commented:
      Dim pendingClient As TcpClient
        Dim nameOfClient As String
        pendingClient = Listener.AcceptTcpClient()
        reader = New System.IO.StreamReader(pendingClient.GetStream)
        nameOfClient = reader.ReadLine()

        test.Add(nameOfClient)

        MessageBox.Show(nameOfClient & " has just signed in.")

        lbUsers.DataSource = test

When I do that the listbox doesn't show anything even though nameofclient has a name in it.
0
HepenAuthor Commented:
I should add that I'm working with threads.
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

CDCOPCommented:
In your code example you have:
test.Add(nameOfClient)

not
listbox1.Items.Add("hello")

You forgot items like Lord said.
0
HepenAuthor Commented:
Wait I can't even get a listbox to add simple text in a simple vb.net windows app.

How do you do that exactly?
0
HepenAuthor Commented:
Can you guys just paste a simple vb.net form1 that adds text to a listbox?
0
CDCOPCommented:
1) Drag a listbox onto the form.
2) Rename it to: lst_1
3) Double click on the grey form (form load event)
4) Paste this code and then complie:
        lb_1.Items.Add("Test Line 1")
        lb_1.Items.Add("Test Line 2")
        lb_1.Items.Add("Test Line 3")

Make sure you get the list box and not a different control!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CDCOPCommented:
Thanks for points and grade.

Were you using the wrong control?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

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.