Thank you all for your answers. My mind was black (or white) yesterday and still was until Kem answer that open it. Read below what I wrote.
Kem answer inspire me the following code.
TA_Data is a TextArea to watch data for debug purposes
FT_Text is a File Type Set (with RAW TEXT and CSV).
I tested it with a 520KB csv file and the data appears at the time the Dialog close (fast, very fast).
My current use is to keep Returns in csv fields (fields are surrounded by quotes, separated with comma, ended with EndOfLine).
This I do not know how to do. Care to expand Kem ?
Jean-Yves:
I used TextInputStream.ReadLine until I add a Return in one field: that does not works in that case (IMHO). That is the reason why I want to Read until my (sort of) EndOfLine (quote for the last field + EndOfLine).
[code] //
// Read Text Data until Delimiter
//
Dim OpenDlg As New OpenDialog
Dim OpenFI As FolderItem
Dim OpenBS As BinaryStream
Dim Delimiter As String
Dim DataArr() As String
// 0. Set the Read Delimiter String
Delimiter = Chr(34) + EndOfLine
// 1. Let the user choose a text file
#If Not TargetLinux Then
OpenDlg.InitialDirectory = SpecialFolder.Documents.Parent.Child(“Downloads”)
#Else //open Home directory on linux
OpenDlg.InitialDirectory = SpecialFolder.Home
#Endif
OpenDlg.Title = “Select a Text file”
OpenDlg.Filter = FT_Text.All
OpenFI = OpenDlg.ShowModal
If OpenFI = Nil Then
// User Cancelled
Return
End If
// 2. Get a BinaryStream Reference
OpenBS = BinaryStream.Open(OpenFI, False)
If OpenBS = Nil Then
MsgBox “Read Data Until Delimiter” + EndOfLine + EndOfLine +_
“An error occured while I was trying to get a BinaryStream.”
Return
End If
// 3. Get the whole data into an array
// DataArr.Append Split(OpenBS.Read(OpenFI.Length), Chr(34) + EndOfLine)
DataArr = Split(OpenBS.Read(OpenFI.Length,Encodings.UTF8), Delimiter)
// 4. Report its contents into the TextArea (TextArea)
TA_Data.Text = Join(DataArr , Delimiter)[/code]
Is the code above OK ?
PS: I have to adapt the code to insert the result into a Listbox, but I have the first steps of the stairs 