drvlistbox, dirlistbox, filelistbox

I

i980565

Hi everyone,

I'm trying to create my own file explorer (or however you want to call
it). I already created a drvlistbox, a dirlistbox, a filelistbox, a
textbox (to specify *.*), 3 labels (displaying the path, etc.) and a
button (which will perform the *.*). I now want to include either a
button which will open the selected file, or just the possibility to
dblclick on the file to open it. However, I have no clue how to do this.
Could somebody help me out with this (I would appreciate it if you are
as specific as possible, I'm only a beginner!).

This is my code untill now!

Private Sub Form_Load()
With lblTitle
.Caption = "DRIVE LIST BROWSER"
.FontSize = 14
.ForeColor = &HFF&
.Alignment = 2
End With
With lblNumFiles
'total number of elements inside the list..
.Caption = FilList.ListCount & " files"
.FontBold = True
.WordWrap = True
End With
With lblExtension
.Caption = "Type of File to View"
.FontBold = True
End With
With TxtExtension
.Text = "*.*"
.FontBold = True
End With
DirDirectory.Path = "D:\database\Brieven\"
CmdExtension.Caption = "&View"

End Sub

----

Private Sub drvFile_Change()
Dim Msg, Msg1 As String
Msg = "Please insert disc inside A:\"
Msg1 = "Please insert CD ROM"
On Error GoTo IF_FILE_NOT_THERE
DirDirectory.Path = drvfile.Drive
Exit Sub

IF_FILE_NOT_THERE:
Select Case drvfile.Drive

Case "a:": MsgBox Msg, , "No A:\ DRIVE"
Case "d:": MsgBox Msg1, , "No CD ROM"
End Select
drvfile.Drive = DirDirectory.Path
End Sub

---

Private Sub dirDirectory_Change()
FilList.Path = DirDirectory.Path
lblNumFiles.Caption = FilList.ListCount _
& " files in " & DirDirectory.Path
End Sub

----

Private Sub cmdExtension_Click()
If (Left(TxtExtension.Text, 2)) <> "*." _
Or Len(TxtExtension.Text) = 0 Then
MsgBox "Just add extension"
TxtExtension.Text = "*."
TxtExtension.SelStart = 2
Else
FilList.Pattern = TxtExtension.Text
End If
End Sub

---

Private Sub button1_Click()

????????????

End Sub
----
and/or
---
filllist??


OK, this is my code, hopefully could help me out!!

Thanx
 
D

Douglas J. Steele

Depends what you mean by "open it".

Do you want to have the file opened with whatever application is associated
with it? (eg.: have Word open it if it's a .DOC file, or Excel if it's a
..XLS file) If so, you can use the ShellExecute API. See
http://www.mvps.org/access/api/api0018.htm at "The Access Web" for sample
code.

BTW, you could probably save yourself some grief by just using the standard
Windows File Open dialog, rather than building your own. Sample code is
available at http://www.mvps.org/access/api/api0001.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top