Ver Mensaje Individual
  #21 (permalink)  
Antiguo 25/04/2008, 03:51
triump
 
Fecha de Ingreso: abril-2008
Mensajes: 33
Antigüedad: 16 años
Puntos: 0
Re: Escribir texto en un formulario

Hola Avellaneda. He escrito este codigo y me crea al archivo y cuando doy al boton de salir no me guarda el texto.

Código:
Dim s As String
Private Sub Cmdprueba_Click()
    End
    
End Sub

Private Sub Form_Click()
Dim i As Integer
For i = 1 To 90 Step 1
        Label1.Caption = i
        Dim x As New frmPostIt
        x.Top = frmPostIt.Top
        x.Left = frmPostIt.Left
        x.Show
         
    Next i
End Sub


Private Sub Form_KeyPress(KeyAscii As Integer)
Dim texto As String
texto = Chr(KeyAscii)
' si el texto llega al margen derecho del form, nueva línea
If Me.CurrentX >= Me.ScaleWidth - 90 Then Me.Print Chr(13)
Me.Print texto;
' cargamos lo tecleado en la variable "s"
s = s & texto
End Sub

Private Sub Form_Unload(Cancel As Integer)
' si no existe Prueba.txt, lo crea y si existe lo sobreescribe
Open App.Path & "\Prueba.txt" For Output As #1
    Print #1, s
Close #1
End Sub