Visual Basic - Opendialog

Life is soft - evento anual de software empresarial
 
Vista:

Opendialog

Publicado por Amilgar (35 intervenciones) el 18/10/2004 18:00:11
Hola kiero abir archivos desde un opendialog, se ke se tiene ke utilizar un commondialog, ya lo hice, si abre el opendialog, pero a la hora ke selecciono un archivo para ke lo abra, nomas no lo abrey se cierra el opendialog, si alguien tiene un ejemplo ke me pueda ayudar, no sean echenme la mano, nomas pido un ejemplo
gracias por su ayuda
Amilgar Manuel Cortes Soberanes
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Opendialog

Publicado por Ruri (583 intervenciones) el 19/10/2004 19:54:41
El commondialog sólo te devuelve la ruta del archivo y nada más. de la apertura del archivo debés encargarte vos. Aqui dejo un ejemplo:

Private Sub Command1_Click()
On Error GoTo Salida
Dim s As String
With CommonDialog1
.CancelError = True
.InitDir = CurDir$
.DialogTitle = "Apertura de archivos"
.Filter = "Archivos rtf (*.rtf)|*.rtf|Archivos de texto (*.txt)|*.txt, Todos los archivos compatibles|*.rtf;*.txt;*.ini;*.log"
.FilterIndex = 0
.Flags = cdlOFNExplorer Or cdlOFNFileMustExist Or cdlOFNHideReadOnly Or cdlOFNLongNames Or cdlOFNReadOnly
.ShowOpen
s = .FileName
End With
'La apertura del archivo no la hace el commondialog
RichTextBox1.LoadFile s
Exit Sub
Salida:
If Err.Number <> cdlCancel Then MsgBox Err.Description, vbInformation Or vbApplicationModal, "Error en la apertura del archivo"
End Sub

Saludos Ruri
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar