Ver Mensaje Individual
  #4 (permalink)  
Antiguo 28/09/2005, 08:04
Avatar de aristotelisco
aristotelisco
 
Fecha de Ingreso: marzo-2005
Ubicación: Oxnard CA USA
Mensajes: 151
Antigüedad: 19 años, 1 mes
Puntos: 0
Código

Código:
Dim sr As StreamReader = New StreamReader("TestFile.txt")
Dim line As String
Dim x As Integer = 0
' Read and display the lines from the file until the end 
' of the file is reached.
      Do 
          x += 1
          line = sr.ReadLine()
          if line.IndexOf(vPalabraABuscar) <> -1 then
               Response.Write("El valor si se encuentra en la linea " & x.ToString) ' Response es para ASP.Net, si usas WinForms, guarda el valor en algun label o TextBox.
          end if
      Loop Until line Is Nothing
sr.Close()
El Método ReadToEnd te pone todo el contenido del archivo en un String, si el archivo no es muy grande, y no te intresa saber la linea en la que se encuentra tu palabra, puedes usar este para evitarte el ciclo Do.
__________________
Atte:
Alex Reyes

www.alexreyes.net