Visual Basic - Leer un archivo txt en vb 6.0

Life is soft - evento anual de software empresarial
 
Vista:

Leer un archivo txt en vb 6.0

Publicado por Antonella (5 intervenciones) el 12/04/2006 16:52:31
Alguien sabe como puedo leer el contenido de un txt que ya tengo creado en vb 6.0?
Gracias!
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Leer un archivo txt en vb 6.0

Publicado por Cecilia Colalongo (3116 intervenciones) el 12/04/2006 17:22:31
Si te refieres a abrir y guardar un archivo de texto en un TextBox fijate con esto:

Text1.Text=FileToString("MiArchivo.txt")

Public Function FileToString(FileName As String) As String
Dim hlngFile As Long, strFile As String

hlngFile = FreeFile

Open FileName For Binary Access Read As hlngFile

FileToString = vbNullString

strFile = String(FileLen(FileName), " ")

Get hlngFile, , strFile

Close hlngFile

FileToString = strFile

End Function

Y para el proceso inverso:

StringToFile Text1.Text,"MiArchivo.txt"

Public Function StringToFile(StringText As String, FileName As String) As Long
Dim hlngFile As Long

hlngFile = FreeFile

Open FileName For Binary Access Write As hlngFile

Put hlngFile, , StringText

Close hlngFile

StringToFile = FileLen(FileName)

End Function
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar