Hi all!
I’ have this code, for get data of a CSV file, load the info and display it on a Listbox:
Dim f As FolderItem
dim tis as TextInputStream
dim s as string
dim i as integer
dim fields() as string
'show standard file selector
f = GetOpenFolderItem(“any” )
if f=nil then exit sub 'cancel clicked
'open the file
tis = f.OpenAsTextFile
if tis=nil then 'failed?
MsgBox(“The file could not be opened.”)
exit sub
end if
'read file into grid
while not tis.EOF 'while not end-of-file
ListBox1.AddRow “” 'add row to grid
s=tis.ReadLine 'read line from file
fields=Split(s,",") 'put items in fileds() array
for i=0 to ListBox1.ColumnCount-1 'copy to grid
ListBox1.HasHeading=True
'Start from row 2 to apart the number one to be the header.
ListBox1.Cell(ListBox1.ListCount-2,i)=Trim(fields(i))
next
wend
tis.Close 'close file
So, I started to count from -2 instead of -1 to discard the row number 1, because I wanna use like the Header.
Now the question is:
How can I get the data of the Headers?.
Regards