Why does this Visual Basic 2010 code not function properly?

Dim SRF As StreamReader = New StreamReader(AppDirectory & "VDLFar.svd")
        Dim all_text As String = SRF.ReadToEnd()

        Dim lines() As String = all_text.Split(CChar(vbCr))
        Dim FarData(lines.Count / 480, 480) as integer
        Dim plotting As Integer = 0
        Dim plots As Integer = 0

        For i = 0 To lines.Count - 1
               FarData(plotting, plots) = integer.parse(lines(i))
               plots += 1
               if plots = 480 then
                     plots = 0
                     plotting +=1
               end if

The problem is in the For/Next loop.  If the multi-dimensional array FarData is changed to only 1 element, the code executes almost instantly through more than 500,000 lines.count.  However, as soon as I change it to a multi-dimensional array as shown above, the time of
execution is enormous.  As a matter of fact, the application times out.  Any suggestion to what I am doing wrong?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

What does this file look like and what exactly are you trying to achieve?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jaime OlivaresSoftware ArchitectCommented:
Parse is a heavy operation, what about trying the following:
  FarData(plotting, plots) = 1
GCCalAuthor Commented:
MIanda:   The file looks like this:


I am trying to get the numbers into approximately 500,000 lines.  Each line will have 480 integers, so it will look like this
in the array:
fardata(1, 1) through fardata(1,480) will look like this 2,3,2,5,3,5,4 etc.

This data will then be used to draw a sine wave for each line.  The sine wave will have 480 points in it.
Hope that makes sense.


I tried this fardata(plotting,plot) = cint(lines(i)), also just fardata(plotting,plots) = lines(i).  Same result.  Only executes properly if
I have just fardata(plot) = integer.parse or any of the other also.  Hope that makes sense.

Thanks for responding so quickly, guys.
GCCalAuthor Commented:
Hey guys...............well, I found my problem.  The problem is not with the code I provided.  Rather the problem
is with the way I created the file that I was reading from.  I was trying to read in data that I thought existed but

So since you took the time to respond, I am going to do a multiple solutions.

Thanks anyway
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.