Textarea1.text to listbox

Push button code:

dim s(-1) as String
  dim i as Integer
  s=Split (TextArea1.Text, EndOfLine)
  for i=0 to s.Ubound
    listbox1.AddRow s(i)

Is this the best way to add a single or multiple lines from a textarea to a listbox?
If I leave out the trim line I get blank rows in the listbox.


for i=0 to s.Ubound if NOT (s(i) = "") Then listbox1.AddRow s(i) end if next

That works…thanks Mark

Listbox1.Cell( -1, -1 ) = TextArea1.Text.Trim

But that won’t skip blank lines like Mark’s version.

That’s nice…but it clears the old content from the listbox.

Yeah, that too. :slight_smile: