Tema: leer .txt
Ver Mensaje Individual
  #2 (permalink)  
Antiguo 21/07/2010, 15:01
Avatar de jaullo
jaullo
 
Fecha de Ingreso: abril-2009
Mensajes: 994
Antigüedad: 15 años
Puntos: 30
Respuesta: leer .txt

Sería algo así:

Código ASP:
Ver original
  1. Sub WriteToFile(sender As Object, e As EventArgs)
  2.  
  3.         Dim fp As StreamReader
  4.  
  5.         Try
  6.             fp = File.OpenText(Server.MapPath(".\Upload\") & "test.txt")
  7.             txtMyFile.Text = fp.ReadToEnd()
  8.             lblStatus.Text = "File Succesfully Read!"
  9.             fp.Close()
  10.         Catch err As Exception
  11.             lblStatus.Text = "File Read Failed. Reason is as follows
  12.  
  13. " & err.ToString()
  14.         Finally
  15.  
  16.         End Try
  17.  
  18.     End Sub

O bien

Código ASP:
Ver original
  1. Dim StreamReader1 As New System.IO.StreamReader(Server.MapPath("test.txt"))
  2. TextBox2.Text = StreamReader1.ReadToEnd()
  3. StreamReader1.Close()
__________________
http://geekswithblogs.net/jaullo/Default.aspx
Si te he ayudado regalame Karma positivo!!!