|
-
Jan 16th, 2006, 12:16 AM
#1
[RESOLVED] Strange problem with DirListBox
I searched on this subject but noone mentioned it before.
If I use a simple combination of a DriveListBox and a DirListBox, and a simple:
dirList.Path = drvList.Drive
code for changing drives, a strange thing happens. When I select C or D drives, the DirListBox opens up on the Root of the drive, which is what is suppose to happen.
BUT, when I select drive E, it opens up to the folder where my code is located. I can't get it to open up on Root. And if I move the code to a different folder, it opens up on that folder.
Added RESOLVED to thread title and green resolved checkmark - Hack
Last edited by Hack; Jan 16th, 2006 at 06:05 AM.
-
Jan 16th, 2006, 12:33 AM
#2
Re: Strange problem with DirListBox
here's a quick fix,
VB Code:
Private Sub drvList_Change()
If LCase$(Left$(App.Path, 2)) = drvList.Drive Then
dirList.Path = Left$(App.Path, 2) & "\"
Else
dirList.Path = drvList.Drive
End If
End Sub
-
Jan 16th, 2006, 12:41 AM
#3
Re: Strange problem with DirListBox
Thanks for the idea. Although I had to make a small change to make it work. I had to use the Left function on the drvList.Drive too because it contains the Name of the drive to.
VB Code:
If LCase$(Left$(App.Path, 2)) = Left$(drvList.Drive, 2) Then
dirList.Path = Left$(App.Path, 2) & "\"
Else
dirList.Path = Left$(drvList.Drive, 2)
End If
Thanks again!
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
|