Hi folks. I'm having some problem here. I have a list of files to read and have to append them all to one unique file. the problem is that when i open the first file to read. I read the first line and discard it. when i read the second line, its empty ! but it is not in the original file. what im doing wrong ? tks for the help
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnGera.Click
Dim QtdPapeis As Integer
Dim I As Integer
Dim oWrite As System.IO.StreamWriter
Dim oRead As System.IO.StreamReader
Dim caminho As String
oWrite = IO.File.CreateText("c:\ibov\carga.txt")
QtdPapeis = PF.SecurityCount() - 1
For I = 0 To QtdPapeis
caminho = "c:\ibov\" & PF.Security(I).GetSymbol & ".txt"
oRead = New System.IO.StreamReader(caminho)
GeraCargaTabelaQuotes(oRead, oWrite)
oRead.Dispose()
Next
oWrite.Dispose()
End Sub
Public Sub GeraCargaTabelaQuotes(ByVal arq_origem As System.IO.StreamReader, ByVal arq_destino As System.IO.StreamWriter)
Dim linhaAtual, linhaescrever, cod, desc, periodo, data, hora, open, high, low, close, volume, interest As String
Dim strArray() As String
linhaAtual = arq_origem.ReadLine() 'pula a 1a linha
linhaAtual = arq_origem.ReadLine()
While (Not arq_origem.EndOfStream)
strArray = linhaAtual.Split(",")
cod = strArray(1)
desc = strArray(2)
periodo = strArray(3)
data = strArray(4).Substring(0, 4) & "-" & strArray(4).Substring(4, 2) & "-" & strArray(4).Substring(6, 2)
hora = strArray(5)
open = strArray(6)
high = strArray(7)
low = strArray(8)
close = strArray(9)
volume = strArray(10)
interest = strArray(11)
linhaescrever = cod & ";" & desc & ";" & periodo & ";" & data & ";" & hora & ";" & open & ";" & high & ";" & low & ";" & close & ";" & volume & ";" & interest
arq_destino.WriteLine(linhaescrever)
linhaAtual = arq_origem.ReadLine()
End While
End Sub