ListBox.AddRow Method have three syntax as far as the docs tell us.
ListBox.AddRow ( ParamArray Item as String )
Appends Item in a new row to the end of the list. Because it is called ParamArray, you can pass several items for a multicolumn ListBox. The items are separated by commas and will be the values for the various columns.
I never understand what code I have to write to make that working
[quote]ListBox.AddRow ( ParamArray Item as String )
Appends Item in a new row to the end of the list. Because it is called ParamArray, you can pass several items for a multicolumn ListBox. The items are separated by commas and will be the values for the various columns.[/quote]
Example:
lbx.AddRow("text0", "text1", "text2")
[quote]ListBox.AddRow ( Item() as String )
Appends a new row to the end of the list with each element of Item as a separate column.[/quote]
Example:
[quote=78720:@Emile Schwarz]Me.AddRow Foo() // Row added, no String
Me.AddRow Foo(0),Foo(1),Foo(2) // Row added, no String[/quote]
These work like you’re thinking, it’s the Foo array that’s wrong.
When you “Dim Foo(2) As String” it starts with indices 0, 1, 2. Then you Append the strings at indices 3, 4, 5.
Make the column count 6 and you’ll see “Me.AddRow Foo()” working.
Or better, start off with “Dim Foo() As String” for an empty array.
Actually, I added a small ListBox (150 x 200) at a window border and so I could not see my error !
Also, I was not clear enough: the real question was "how when I load text from a textfile (using TextInputStream), I can use .AddRow and fill the whole columns in on line of code).
Christian:
Oh, I understand now why I do not understand previously
My rule is:
For every string which comes from an external source I use DefineEncoding.
For every string which goes to an external target I use ConvertEncoding.
Unless you are absolutely sure that the source or target uses utf8 - but even then I do it.
(external source/target means databases, files, tcpsockets, …)
[quote=79015:@Emile Schwarz]Yes, but the default encoding in Xojo is UTF-8.
[/quote]
Not for text read from the outside. Xojo may have known it was UTF-8 when you wrote it, but when you read it back in, it has no idea. You have to define it explicitly when you read it in.