New topic: Reading csv file
<http://forums.realsoftware.com/viewtopic.php?t=29241> Page 1 of 1 [ 2 posts ] Previous topic | Next topic Author Message djobes31770 Post subject: Reading csv filePosted: Sun Jul 26, 2009 6:09 pm Joined: Mon Aug 27, 2007 3:36 pm Posts: 69 I am trying to use the code for reading a csv file into a listbox: Code: dim f as FolderItem dim tis as TextInputStream dim s, r as String dim i as Integer dim fields() as String dim csvType as New FileType ' show folder Selection f = GetOpenFolderItem(csvType) if f=nil then exit Sub 'Open File tis = f.OpenAsTextFile() if tis=nil then MsgBox("File could not be opened") exit sub end if ' read data 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.Cell(ListBox1.ListCount-1,i)=Trim(fields(i)) next wend tis.Close The csv file i am reading has a few different values, not a real standard csv file im thinking, it is only loading the first col and nothing else. any ideas Top Indy Post subject: Re: Reading csv filePosted: Sun Jul 26, 2009 8:45 pm Joined: Wed Jul 09, 2008 10:46 pm Posts: 90 Location: Minneapolis djobes31770 wrote:The csv file i am reading has a few different values, not a real standard csv file im thinking, it is only loading the first col and nothing else. any ideas Worked for me in a quick test. Did you set your listbox to have more than 1 column? _________________ http://www.miscjunk.org Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 2 posts ] -- 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]
