Real Software Forums

Populating listbox
Page 1 of 1

Author:  vkozme [ Thu May 03, 2012 10:15 pm ]
Post subject:  Populating listbox

Hi, guys,

I am trying to make RB read a coma delimited text file (two fields per line) and populate the data into a ListBox that has two colums.

For some reason, RB places the entire line from my text file into the first column. Could someone please help me to find a solution?

Here is my code.

[size=85]Dim t As TextInputStream
Dim f As FolderItem
Dim dlg As OpenDialog

dlg = New OpenDialog

f = dlg.ShowModal() // open open dialog for selecting a file to load

Dim rowFromFile,oneCell As String
Dim i As Integer
If f <> Nil Then
t =TextInputStream.Open(f)
t.Encoding=Encodings.MacRoman //strings are MacRoman

ListBox1.AddRow NthField(rowFromFile,Chr(9),1)
For i=1 to CountFields(rowFromFile,Chr(9))
Loop Until t.EOF
End If[/size]

Thank you in advance.


Author:  DaveS [ Thu May 03, 2012 10:59 pm ]
Post subject:  Re: Populating listbox

Uh... if you are reading a COMMA delimited file... why are you splitting the input line with TABS (chr(9))??????

Author:  vkozme [ Fri May 04, 2012 12:05 am ]
Post subject:  Re: Populating listbox

Thanks, Dave,

Of course, I need Chr(44) for coma! Now it works.

I very appreciate your help.


Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group