[Do While (readerVar.Peek <> -1)] --> Doesnt this line suppose to terminate the loop when it comes to the end of the file and have no more line to read? In my program it just went on reading the lines over and over again when i wanted it to open another new file when it has finish reading all the line in one file.
readerVar = IO.File.OpenText("D:\project1\ANN\" & File(i)) ---> Will this line work? I want it to load a new file everytime it is done with the old file but it always ended with error when i try to run the program.
Another question is in my sub program Sparsecode(Line1, matrixA), i made used of stringbuilder and had this line --> result.Append(sparse(position))
after which i took out the individual chars and put it in arrays. I do not want it in string so i tried converting it to double using CDbl but it doesnt work, Came up error exception when i tried to run it. Why is it so?
Thanks!
Expand|Select|Wrap|Line Numbers
- Dim FileName As String
- Dim File(12) As String
- FileName = Dir("D:\project1\ANN\*Chain*")
- Do While FileName <> ""
- File(x) = FileName
- x += 1
- FileName = Dir()
- Loop
- Dim readerVar As IO.StreamReader
- Dim source1, source2, Line1, Line2 As String
- Dim n, i As Integer
- Dim matrixA(0 To 273) As String
- Dim Desired(0 To 3) As String
- i = 0
- For i = 0 To 12
- readerVar = IO.File.OpenText("D:\project1\ANN\" & File(i))
- Do While (readerVar.Peek <> -1)
- source1 = readerVar.ReadLine
- source2 = readerVar.ReadLine
- source1 = ("XXXXXX" & source1 & "XXXXXX")
- For n = 0 To (source1.Length - 13)
- Line1 = source1.Substring(n, 13)
- Line2 = source2.Substring(n, 1)
- Sparsecode(Line1, matrixA)
- SSE(Line2, Desired)
- Next
- Loop
- readerVar.close()
- Next