Ver Mensaje Individual
  #1 (permalink)  
Antiguo 29/09/2011, 16:59
Pilotillo
 
Fecha de Ingreso: agosto-2010
Mensajes: 26
Antigüedad: 13 años, 8 meses
Puntos: 0
Leer linea por linea un archivo de texto plano

Buenas de nuevo,pues necesito leer linea por linea un archivo plano y cada linea mandarla a un textbox.
El problema es que lo hago segun la msdn y la primera linea me sale ok,pero no se como indicar la segunda linea lo he intentado con for next, pero nada, copio el codigo que llevo.

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

'Declaramos la variable donde tenemos el archivo de texto
Dim text_file As String
text_file = "e:\julian.txt"
'Comprobamos que existe el archivo
If System.IO.File.Exists(text_file) Then
MsgBox("El archivo existe")
Else
MsgBox("El archivo no existe")
End If

' Primera(variable)

Dim leer0 As System.IO.StreamReader
leer0 = My.Computer.FileSystem.OpenTextFileReader(text_fil e)
Dim stringReader As String
stringReader = leer0.ReadLine()
TextBox1.Text = stringReader

'Segunda variable
Dim leer1 As System.IO.StreamReader
Dim stringreader1 As String
For i = 0 To 5

leer1 = My.Computer.FileSystem.OpenTextFileReader(text_fil e)
stringreader1 = leer1.ReadLine()

Next
TextBox2.Text = stringreader1


End Sub
End Class

Luego me gustaria pasar cada textbox a una celda de excel ,para tener un historico de esos datos ¿seria posible?

Última edición por Pilotillo; 29/09/2011 a las 17:00 Razón: quiero seguir el tema