Ver Mensaje Individual
  #1 (permalink)  
Antiguo 18/07/2008, 03:55
Ethiel
 
Fecha de Ingreso: septiembre-2007
Mensajes: 173
Antigüedad: 16 años, 8 meses
Puntos: 0
Problema al leer txt: loop infinito

Buenas.

Tengo un problema al leer el txt utilizando visual basic.net 2005. Resulta que no detecto el final del archivo, y vuelve a comenzar a leer de nuevo, siendo el bucle infinito.


Private Function estaNumeroEnTxt(ByVal numerotrabajador As Integer)

Const fic As String = "C:\Archivos de programa\CreaUsuarios\pepe2.txt"
Dim texto As String
Dim numero As String
Dim num As Integer
Dim oFile As System.IO.File
Dim oRead As System.IO.StreamReader


Dim sr As StreamReader
sr = oFile.OpenText(fic)




Dim filenumber As Integer


numero = numerotrabajador

numero = 13
Dim enc As Boolean = False




texto = sr.ReadLine
Do While Not texto Is Nothing




If Not texto Is Nothing Then
MsgBox(texto)
Else
MsgBox("encontrado " & texto)
enc = True
End If

texto = sr.ReadLine
Loop

rs.close()

¿Alguna ayudita?
__________________
http://javautil.blogspot.com/

Blog de programación en JAVA con apuntes, dudes, manuales, aplicaciones y mas.