Añada el siguiente código:
Private Sub Command1_Click()
Dim canalLibre As Integer
'Obtenemos un canal libre que nos dará
'el sistema oparativo para poder operar
canalLibre = FreeFile
'Abrimos el fichero en el canal dado
Open "C:\fichero.txt" For Output As #canalLibre
'Escribimos el contenido del TextBox al fichero
Print #canalLibre, Text1
Close #canalLibre
End Sub
Dim canalLibre As Integer
'Obtenemos un canal libre que nos dará
'el sistema oparativo para poder operar
canalLibre = FreeFile
'Abrimos el fichero en el canal dado
Open "C:\fichero.txt" For Output As #canalLibre
'Escribimos el contenido del TextBox al fichero
Print #canalLibre, Text1
Close #canalLibre
End Sub
Nuevo
Para abrir:
Código:
Dim foo As Integer
foo = FreeFile
Open "C:\Archivo.txt" For Input As #foo
Text1.Text = Input(LOF(foo), #foo)
Close #foo
Dim foo As Integer
foo = FreeFile
Open "C:\Archivo.txt" For Input As #foo
Text1.Text = Input(LOF(foo), #foo)
Close #foo
Para guardar:
Código:
Dim foo As Integer
foo = FreeFile
Open "C:\Archivo.txt" For Output As #foo
Print #foo, Text1.Text
Close #foo
Dim foo As Integer
foo = FreeFile
Open "C:\Archivo.txt" For Output As #foo
Print #foo, Text1.Text
Close #foo
dialogos:
Ese es para Abrir
Código:
Dim strOpen As String
CommonDialog1.ShowOpen
strOpen = CommonDialog1.FileName
Text1.LoadFile strOpen
Text1.LoadFile strClose
Dim strOpen As String
CommonDialog1.ShowOpen
strOpen = CommonDialog1.FileName
Text1.LoadFile strOpen
Text1.LoadFile strClose
Ese para guardar
Código:
Dim strNewFile As String
CommonDialog1.ShowSave
strNewFile = CommonDialog1.FileName
Text1.SaveFile strNewFile
Dim strNewFile As String
CommonDialog1.ShowSave
strNewFile = CommonDialog1.FileName
Text1.SaveFile strNewFile
No hay comentarios:
Publicar un comentario