|
-
Apr 10th, 2000, 01:52 AM
#1
Thread Starter
Lively Member
I have researched the various API calls, common dialog options, etc. but still can't find a decent answer.
Is it possible, using ANY of these methods, to display to the user only folders beneath a certain directory?
That is, assume the default path is C:\mail\2000.
I want to force the user to select only subdirectories (folders) beneath this (which include Jan_Mail, Feb_Mail, etc.).
When the user first sees the "Browse for Directory" box, it should display ONLY the 2000 folder. Then, the user has to select one folder such as Jan_Mail, Feb_Mail, March_Mail, etc. Can this be done, or must you always start from a predefined root (Desktop, C:\Windows, etc.)???
THANKS for any insight and advice.
Steve
-
Apr 10th, 2000, 03:42 AM
#2
Addicted Member
Design your custom form using the TreeView control, design it so that the top-level Node is for the root directory that you want it to be, it takes some coding but I believe this will give you what you want.
-
Apr 10th, 2000, 08:59 AM
#3
Thread Starter
Lively Member
TreeView Rocks!
Thanks a lot SonGouki, that is exactly what I needed!
As a side note, do you know a quick method that returns just the subdirectory/folder selected from TreeView?
Example: Mailouts.SelectedFolder = C:\mail2000\mail0428
How do I move just the last folder selected (mail0428) into a variable using string manipulation?
Thanks Again!
Steve
-
Apr 10th, 2000, 09:16 AM
#4
Addicted Member
You can use the InStrRev function as follows:
Code:
Dim iSeparatorPos As Integer
Dim sFullPath As String
Dim sSubDir As String
sFullPath = Mailouts.SelectedFolder
If Right(sFullPath, 1) = "\" Then
sFullPath = Mid(sFullPath, 1, Len(sFullPath) - 1)
End If
iSeparatorPos = InStrRev(sFullPath, "\")
If iSeparatorPos > 0 Then
sSubDir = Mid(sFullPath, iSeparatorPos + 1)
Else
sSubDir = sFullPath
End If
Call MsgBox(sSubDir)
Hope this is what you were looking for.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|