Troubles with Open text and set it to a ListBox

The code below adds a Column / use the comma (when one exist) to create a new Column.

his is an example of an “offending” line:

Popeye 1941-01-11	Go West, Young Gal !	The Reading Eagle

Notice the comma in the line. That comma is taken as a column delimiter by Xojo. I have a bunch of lines with comma and Xojo do the same with these lines.

[code] Do Until OpenTIS.EOF
Dim RowToAdd As String

// a. Get one line from the file
OneRow = ReplaceLineEndings(OpenTIS.ReadLine,EndOfLine)

// DecodeRow returns a tab delimited string
RowToAdd = OneRow // Was: DecodeRow(OneRow, Column_Delimiter, Column_Count)

// b. Add it to the ListBox
LB.AddRow ""
LocRow = LB.LastIndex
LB.Cell(LocRow,-1) = RowToAdd

// c. To avoid 1, Infinite Loop
If UserCancelled Then Exit

Loop[/code]

Nota: in the debug process that leads to the code above, I had to put many things into my code and at last disabled the method that deals with OneRow to find why that application do not do what I expect to it.
You can imagine all the changes I’ve done in that method before trying to not use it and found the trouble there.

BTW: I am aware of the ListBox alternate column delimiter ‘,’, but the other Column Delimiters are the Tab !

To be sure, I deleted the “Debug” folder before every runs.

I was not able to get a way to build a string (and I tried a lot of strings) that display the bug * like:
RowToAdd = “some string with a bunch of Tabs and one comma…”

LB.AddRow "" // Place to set the test string and comment the two next lines LocRow = LB.LastIndex LB.Cell(LocRow,-1) = RowToAdd // or use the test string filled in RowToAdd

Even this is displayed correctly:

RowToAdd = "Column 0" + Chr(9) + "Column,1" + Chr(9) + "Column 2" + Chr(9) + "Column 3" RowToAdd = ConvertEncoding(RowToAdd,Encodings.UTF8)
With or without the second line !

  • For that I have an incredible imagination, but I failed.

At last: I failed, but I spend many days before asking for help.

Oh ! I forgot to write:

Windows 8.1
Xojo 2014r3

After a long break, an idea came to mind:

what if I enclose my data with double quotes ?

"Popeye 1941-01-11"	"Go West, Young Gal !"	"The Reading Eagle"

All of a sudden, my unchanged code started to ignore the comma (when I open a Tab delimited file) !

Nota: I also escaped the double quote character (using 2 x double quotes) at load time.
And while I was on it, I added (escaped double quotes and) the double quotes to my save as Tab .txt. Read my other conversation.

May I suggest there is something wrong with Xojo ?

REMEMBER: same code, same application, different text (read above) that now work fine.