drummy 0 Newbie Poster

Greetings group,

Hopefully someone can help me. I'm trying to essentially append elements (in a Collection List) from another column to a different file (e.g. take a set of columns and append them on another file). I've tried nested For Each loops to write out each element line by line, but that doesn't seem to work. Any suggestions? Here's the code:

Dim FILE_NAME As String = "C:\AGGREGATED.txt" '
        Dim objWriter As New System.IO.StreamWriter(FILE_NAME, False) '
        objWriter.WriteLine("Easting" & vbTab & "Northing" & vbTab & "Depth" & vbTab & "East Mean" & vbTab & "D Mean" & _
                            vbTab & "E StDev" & vbTab & "D StDev" & vbTab & "Skew" & vbTab & "Kurt" & vbCrLf)


        Dim edaLines() As String = System.IO.File.ReadAllLines("C:\EDA.txt")
        Dim regressLines() As String = System.IO.File.ReadAllLines("C:\Residuals.txt")

        ''Reload EDA File and Prepare for Aggregration
        Dim listEDA As New List(Of Double())
        For Each strEDA As String In edaLines
            Dim eleEDA() As Double = Array.ConvertAll(strEDA.Split(vbTab), Function(k) Double.Parse(k)) 
            listEDA.Add(eleEDA)
        Next

        'Reload Regression File and Prepare for Aggregation
        Dim listRegression As New List(Of Double())
        For Each strRgr As String In regressLines
            Dim eleRegress() As Double = Array.ConvertAll(strRgr.Split(vbTab), Function(k) Double.Parse(k)) 
            listRegression.Add(eleRegress)
        Next

'Need to put this somewhere:
objWriter.Writeline(eleEDA(0) & " " & eleEDA(1) & " " & eleRegress(0) & " " & eleRegress(1)

objWriter.Close()

'If I nest the For Each loops, I get essentially an infinite loop (I 'have 3000 objects with 9 elements in each object)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.