Foros del Web » Programación para mayores de 30 ;) » Programación General » Visual Basic clásico »

Abrir y editar un archivo txt

Estas en el tema de Abrir y editar un archivo txt en el foro de Visual Basic clásico en Foros del Web. hola a todos tengo el siguiente problema en un archivo txt tengo alojados dos lineas de texto, la primera se refiere al nombre del tipo ...
  #1 (permalink)  
Antiguo 01/07/2009, 16:22
 
Fecha de Ingreso: mayo-2009
Mensajes: 19
Antigüedad: 15 años
Puntos: 0
Abrir y editar un archivo txt

hola a todos

tengo el siguiente problema
en un archivo txt tengo alojados dos lineas de texto, la primera se refiere al nombre del tipo de moneda (ej: dolar), en la segunda el simbolo (ej: $)
deseo abrir ese archivo y a la vez poder editar para modificar esos datos
no logro corregir el error que esta en algun lugar del codigo
el codigo es el siguiente
Option Explicit
Dim intCtr As String
Dim IntNumAr As Integer
Dim IntVal As Integer
Dim str_Linea As String
Dim mivariable As String

Private Sub cmdAceptar_Click()
IntNumAr = FreeFile
Open App.Path & "\moneda.txt" For Output As #IntNumAr
intCtr = txtMoneda.Text
Print #IntNumAr, str_Linea
Print #IntNumAr, mivariable
Close #IntNumAr
cmdCancelar.Caption = "Salir"
End Sub

Private Sub Form_Load()
Dim Lineas As Long
IntNumAr = FreeFile
Open App.Path & "\moneda.txt" For Input As #IntNumAr
Do
Line Input #IntNumAr, str_Linea
Lineas = Lineas + 1
If Lineas = 1 Then
Line Input #1, mivariable
txtMoneda.Text = str_Linea
End If
Loop While Not EOF(IntNumAr)
txtSimbolo.Text = mivariable
Close #IntNumAr
End Sub


gracias!!!
  #2 (permalink)  
Antiguo 29/09/2009, 15:01
Avatar de lokoman  
Fecha de Ingreso: septiembre-2009
Mensajes: 502
Antigüedad: 14 años, 7 meses
Puntos: 47
Respuesta: Abrir y editar un archivo txt

Cita:
Iniciado por carlosanpy Ver Mensaje
hola a todos

tengo el siguiente problema
en un archivo txt tengo alojados dos lineas de texto, la primera se refiere al nombre del tipo de moneda (ej: dolar), en la segunda el simbolo (ej: $)
deseo abrir ese archivo y a la vez poder editar para modificar esos datos
no logro corregir el error que esta en algun lugar del codigo
el codigo es el siguiente
Option Explicit
Dim intCtr As String
Dim IntNumAr As Integer
Dim IntVal As Integer
Dim str_Linea As String
Dim mivariable As String

Private Sub cmdAceptar_Click()
IntNumAr = FreeFile
Open App.Path & "\moneda.txt" For Output As #IntNumAr
intCtr = txtMoneda.Text
Print #IntNumAr, str_Linea
Print #IntNumAr, mivariable
Close #IntNumAr
cmdCancelar.Caption = "Salir"
End Sub

Private Sub Form_Load()
Dim Lineas As Long
IntNumAr = FreeFile
Open App.Path & "\moneda.txt" For Input As #IntNumAr
Do
Line Input #IntNumAr, str_Linea
Lineas = Lineas + 1
If Lineas = 1 Then
Line Input #1, mivariable
txtMoneda.Text = str_Linea
End If
Loop While Not EOF(IntNumAr)
txtSimbolo.Text = mivariable
Close #IntNumAr
End Sub


gracias!!!


Hola!!!
Nunca es tarde para responder...
Verifica la subrutina del boton aceptar:

Private Sub cmdAceptar_Click()
IntNumAr = FreeFile
Open App.Path & "\moneda.txt" For Output As #IntNumAr
Print #IntNumAr, txtMoneda.Text
Print #IntNumAr, txtSimbolo.Text
Close #IntNumAr
cmdCancelar.Caption = "Salir"
End Sub

Nos Cuentas!!!
---
lkz.-
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 21:01.