Textbox text to a listbox [solved]

Posts 1–9 of 9 · Page 1 of 1
Textbox text to a listbox [solved]
Ok so i know how to add a single line from a textbox to a listbox but, How do i add a multilined textboxs text to a listbox so heres an example.

the textboxs text has this is in
Code:
Dog
Cat
Watermelon
Puppy
Kitten
But i can only get the word Dog to the listbox.
(i know i am not very good at explaining so i if you don't understand and need me to go into further detail for you to help me then just tell me.)

For i as Integer = 0 to TextBox1.Lines.Count - 1

ListBox1.Items.Add(TextBox1.Lines(i))

Next



Something like this??
1. For
2. XXX.Lines().XX
3. XXX.Add(xxx)
4. ????
5. profit

use logic..

Oh god.. spoonfeed above me
I got this one

Code:
For Each TextToWrite As String In TextBox1.Lines
            Try
                ListBox1.Items.Add(TextToWrite)
            Catch
            End Try
        Next
[highlight="VB.Net"]Listbox1.items.addrange(textbox1.lines)[/highlight]

should work aswell...
Quote Originally Posted by Blubb1337 View Post
[highlight="VB.Net"]Listbox1.items.addrange(textbox1.lines)[/highlight]

should work aswell...
Yep , I think this is better.
How about?
[highlight=vb.net]for each line in textbox1.text.split(vbcrlf)
listbox1.items.add(line)
next[/highlight]
thanks guys i got it working
Marked solved. Blubb's solution is the best.
Posts 1–9 of 9 · Page 1 of 1

Post a Reply

Tags for this Thread

None

Talk with us