Ver Mensaje Individual
  #4 (permalink)  
Antiguo 06/01/2006, 10:40
Avatar de David
David
Moderador
 
Fecha de Ingreso: abril-2005
Ubicación: In this planet
Mensajes: 15.720
Antigüedad: 19 años
Puntos: 839
Cita:
Iniciado por luis557
Hola David e echo un programa y quisiera guardar datos de unos texbox en un fichero para poder abrirlos y que cojan el valor guardado

Gracias
Código:
Sub SaveTextBoxInFile(ByVal FileName As String, ByRef Text As TextBox)
On Error Resume Next
Close
Open FileName For Output As #1
If Err > 0 Then Exit Sub
Print #1, Text.Text
Close
End Sub
Sub GetFileToTextBox(ByVal FileName As String, ByRef Text As TextBox)
On Error Resume Next
Close
Open FileName For Input As #1
If Err > 0 Then Exit Sub
Text.Text = Input(LOF(1), 1)
Close
End Sub
Private Sub Command1_Click()
GetFileToTextBox "C:\Texto.txt", Text1
End Sub
Private Sub Command2_Click()
SaveTextBoxInFile "C:\Texto.txt", Text1
End Sub
Lo que hacen las funciones es abrir los archivos con el modo correspondiente para poder escribir o leer el fichero...
__________________
Por favor, antes de preguntar, revisa la Guía para realizar preguntas.