Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Sun Aug 25, 2019 8:45 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Populating listbox
PostPosted: Thu May 03, 2012 10:15 pm 
Offline

Joined: Fri Oct 21, 2005 7:51 pm
Posts: 223
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
Do
rowFromFile=t.ReadLine

ListBox1.AddRow NthField(rowFromFile,Chr(9),1)
For i=1 to CountFields(rowFromFile,Chr(9))
oneCell=NthField(rowFromFile,Chr(9),i)
ListBox1.Cell(ListBox1.ListCount-1,i-1)=oneCell
ListBox1.CellType(ListBox1.LastIndex,0)=ListBox.TypeCheckBox
Next
Loop Until t.EOF
t.Close
End If[/size]


Thank you in advance.

vkozme


Top
 Profile  
Reply with quote  
 Post subject: Re: Populating listbox
PostPosted: Thu May 03, 2012 10:59 pm 
Offline
User avatar

Joined: Sun Aug 05, 2007 10:46 am
Posts: 4931
Location: San Diego, CA
Uh... if you are reading a COMMA delimited file... why are you splitting the input line with TABS (chr(9))??????

_________________
Dave Sisemore
iMac I7[2012], OSX Mountain Lion 10.8.3 RB2012r2.1
Note : I am not interested in any solutions that involve custom Plug-ins of any kind


Top
 Profile  
Reply with quote  
 Post subject: Re: Populating listbox
PostPosted: Fri May 04, 2012 12:05 am 
Offline

Joined: Fri Oct 21, 2005 7:51 pm
Posts: 223
Thanks, Dave,

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

I very appreciate your help.

vkozme


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group