Visual Basic - Por Favor ayudenme

Life is soft - evento anual de software empresarial
 
Vista:

Por Favor ayudenme

Publicado por Miguel (1 intervención) el 15/03/2008 17:14:20
Hola, saludos a todos, lo que necesito saber es como puedo hacer que al apretar un boton busque el archivo que yo quiera, salga la ruta y esa misma ruta al pinchar en otro boton se abra.

Dejo unos codigos, e estao tocando pero no encuentro la manera, por favor ayudenme, gracias.

Private Sub Form_Load()
ruta = App.Path & " 'coloca aqui la ruta"
End Sub

Private Sub Command1_Click()

Dim strValor As String
strValor = FindFile$(ruta$, "serial.txt")
If Not strValor = "" Then
MsgBox "ARCHIVO ENCONTRADO LA RUTA ES: " & Chr(13) & " " & strValor & " ", vbCritical, "Buscar"""
Else
MsgBox "NO SE ENCONTRO : " & strValor & " ", vbInformation, "Buscar"""
End If
End Sub

Sub Command2_Click()
Dim strValor As String
strValor = FindFile$(ruta$, "serial.txt")
If Not strValor = "" Then
End If
Dim Shell As String
Shell = Shell & Chr(13) & " " & strValor & " "
End Sub
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:Por Favor ayudenme

Publicado por rolando lau (115 intervenciones) el 15/03/2008 18:42:37
En la cabecera del form donde llamaras a tus archivos

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Private Sub command_Click()
'Shell "<Ruta del Archivo>", vbMaximizedFocus
'x = Shell("Ruta del Archivo")
End Sub

Listo ahora buscar en directorio ...
consiguete un ejemplo hay mucho por ahi

y simplemente le mandas el parametro de la ruta

saludos

Rolando
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

RE:Por Favor ayudenme

Publicado por gustavo (218 intervenciones) el 15/03/2008 20:44:15
amigo, se que hablas de botones, pero existen driverlistbox, filelistbox, dirlistbox que te permiten hacer una especie de explorador y dando clic en cada uno puedes ir explorand la raiz del equipo te coloco un codigo que permite buscar archivos jpg

Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub Drive1_Change()
On Error GoTo drive_error
Dir1.Path = Drive1.Drive
Exit Sub
drive_error:
MsgBox "error: Unidad no Preparada", vbCritical, "Error"
Exit Sub
End Sub

Private Sub File1_Click()
Dim archivo As String
archivo = File1.Path & ""
archivo = archivo & File1.List(File1.ListIndex)
Image1.Picture = LoadPicture(archivo)
FRM_DATOS_MEC.lbl_foto.Caption = archivo
End Sub

Private Sub Image1_Click()
archivo = File1.Path & ""
archivo = archivo & File1.List(File1.ListIndex)
FRM_DATOS_MEC.lbl_foto.Caption = archivo

End Sub
espero te ayude
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