bizzare string concatanate issue

ymee

New member
Joined
Feb 17, 2010
Messages
3
Programming Experience
Beginner
Hi Guys,

I'm running into a bizzare problem. I have a program where I read a text file into a temparray which has been declared as an ArrayList()

Once the text file has been read in I can see that temparray is of size 4 elements which is expected.

I then try to concatenate the 4 elements into one string array and this is where I am running into issues. For some reason only the first two elements get concatenated and elements 3 and 4 do not get tacked on. The elements/strings are not too large, maybe 100 to 200 characters each.

Could there be a hidden character in the text file that is throwing the concatenation off?

I have also tried to individually assign the 4 elements of the temparray to 4 temp strings a,b,c and d and they all show up correctly in the quickwatch section. However concatenating them like tempstring=a & b & c & d also only concatenates a & b only.

Please help, I'm about to tear my hair out.
 
Here is the code so far. I am not a programmer by profession so please don't laugh at the syntax, I'm sure there are many errors.



Dim temparray As New ArrayList()
Dim Endflag As Boolean
Dim i As Integer
Dim fs2 As New FileStream(tempfilepath, FileMode.Open, FileAccess.Read)

Dim s2 As New StreamReader(fs2)

DeltaWatchDogResults = ""

While s2.Peek() > -1
temparray.Add(s2.ReadLine)


End While
fs2.Close()
s2.Close()
fs2.Dispose()
s2.Dispose()



If temparray.Count > 0 Then
For i = 0 To temparray.Count - 1

DeltaWatchDogResults &= temparray(i).ToString
DeltaWatchDogResults &= Chr(10)
Next
End If



End Sub
 
I don't really understand what you're trying to achieve. It looks like you're reading the file line by line, then putting all the lines back together, but with line breaks between them. That simply gives you the contents of the file again, so what's all the song and dance for? What exactly are you trying to achieve?
 
Back
Top