← Foro de Visual Basic

Mensaje de abriendo archivo

Hilo en el foro de Visual Basic · 25 de Octubre del 2004 · 1 respuestas
soraia25 de Octubre del 2004
Pregunta
hola a todos
Cuando abres cualquier archivo desde visual. ¿como puedo añadir un mensaje, que indique que se está abriendo ese archivo, en caso de encontrarlo?
Muchas gracias

Respuestas 1

Ivan Figueroa25 de Octubre del 2004
Buen Día:
Le envío un ejemplo que espero le sirva y aclare sus dudas, puede preguntarme directo a mi E-Mail. Cree un archivo con el nombre ‘Ejemplo.frm’ y en su interior ponga el código siguiente:
=========================
VERSION 5.00
Begin VB.Form frmMain
Caption = "Ejemplo de como leer un archivo"
ClientHeight = 990
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 990
ScaleWidth = 4680
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton cbLeerArchivo
Caption = "Leer Archio"
Height = 375
Left = 960
TabIndex = 1
Top = 480
Width = 2295
End
Begin VB.Label LabTexto
AutoSize = -1 'True
Caption = "Estado:"
Height = 195
Left = 120
TabIndex = 2
Top = 120
Width = 540
End
Begin VB.Label labEstado
Height = 195
Left = 720
TabIndex = 0
Top = 120
Width = 3780
End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub cbLeerArchivo_Click()
On Local Error Resume Next

Dim Archivo As String

Archivo = InputBox("Nombre del Archivo:")
If Archivo = "" Then Exit Sub

Open Archivo For Input As #1
If Err.Number = 0 Then
labEstado.Caption = "Abriendo el Archivo"

' Aquí va el código que Ud desee para
' manipular el Archivo Abierto.

labEstado.Caption = "El Archivo fue manipulado satisfactoriamente"
Else
labEstado.Caption = Err.Description
Err.Clear
End If
Close #1
End Sub
=========================
Después agréguelo a un Proyecto y pruébelo.
Saludos y mucha suerte,
Iván Figueroa (El Figuero)

¿Buscas más hilos como este? Mira el foro de Visual Basic o usa el buscador.