Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.visual.basic    |    MS Visual Basic discussions, NOT dot-net    |    10,840 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 9,912 of 10,840    |
|    argusy to Paul M. Cook    |
|    Re: Null values in variant array    |
|    25 Feb 06 13:57:12    |
      From: argusy@slmember.on.net              Paul,       if you can look at the csv file, (wordpad, whatever that works), see how many       carriage return/line feeds are at the end of the file.       If your csv data generator consistently returns the same number of CrLfs, then       you can set up your loop count subtracting the extraneous number of crLfs       generated.       If it varies, then you may have to do a reverse string search, counting CrLfs       until you get valid data, and either modify your loop count depending on how       many show up, or redim your upper boundary on your array to fix it.              see if just looping from 0 to line count-1 fixes the problem.       (and you get all your data)              look up help on "option base"              Argusy              Paul M. Cook wrote:       > Let's say you have a CSV file and you load it into a variant array using the       > split function on VBCrLF. Then you load a variable with the line count and       > loop through the array for 0 to line count. This works well unless you have       > blank lines at the end of the CSV file. Now if you process the loop, you'll       > get an out of bounds subscript at the end of the loop because you are       > referencing null values at the end of the variant array.       >       > How would you go about stripping the extraneous CRLFs from the end of the       > file?       >       > Paul       >       >              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca