New topic: 

How to catch end of text file

<http://forums.realsoftware.com/viewtopic.php?t=47753>

         Page 1 of 1
   [ 1 post ]                 Previous topic | Next topic          Author  
Message        Dralion          Post subject: How to catch end of text 
filePosted: Wed May 01, 2013 6:07 am                         
Joined: Sat Mar 15, 2008 8:14 am
Posts: 160
Location: Montreal, Quebec, Canada                Hi everyone
because i have a text file (tab delimited) of 144 column
i'v split my reading in more than one listbox ( because lb cant contain more 
than 64 )
BUT i have a OutofBound Exception error
Because my condition of read to EOF is at the first lvel of my loop
and if it reach the end of the data inside a loop of listbox distribution then 
goes error
check my code and you'll understand
How can i stop the reading before out of data  while not tis.EOF        'while 
not end-of-file
  
  s=tis.ReadLine        'read line from file
  fields=Split(s,chr(9))    'put items in fileds() array
  
  
  
  ListBox11.AddRow ""
  ListBox12.AddRow ""
  ListBox13.AddRow ""
  ListBox14.AddRow ""
  
  
  
  for i=0 to ListBox11.ColumnCount-1
  oo = i + 1
  ListBox11.Cell(ListBox11.ListCount-1,i)=Trim(fields(i))
  next
  '
  for i=0 to ListBox12.ColumnCount-1
  oo = i + 60
  ListBox12.Cell(ListBox12.ListCount-1,i)=Trim(fields(oo)) 'if i reach the end 
of data here... boom error
  next
  '
  for i=0 to ListBox13.ColumnCount-1
  oo = i + 120
  ListBox13.Cell(ListBox13.ListCount-1,i)=Trim(fields(oo))
  next
  
  for i=0 to ListBox14.ColumnCount-1
  oo = i + 180
  ListBox14.Cell(ListBox14.ListCount-1,i)=Trim(fields(oo))
  next
  
Wend


Thanks      
_________________
--------------------
RB 2011r4 on win7  
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 1 post ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to