Results 1 to 3 of 3

Thread: [RESOLVED] Strange problem with DirListBox

  1. #1

    Thread Starter
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Resolved [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.

  2. #2
    Frenzied Member Jmacp's Avatar
    Join Date
    Jul 2003
    Location
    UK
    Posts
    1,959

    Re: Strange problem with DirListBox

    here's a quick fix,

    VB Code:
    1. Private Sub drvList_Change()
    2.  
    3.     If LCase$(Left$(App.Path, 2)) = drvList.Drive Then
    4.         dirList.Path = Left$(App.Path, 2) & "\"
    5.     Else
    6.         dirList.Path = drvList.Drive
    7.     End If
    8.  
    9. End Sub

  3. #3

    Thread Starter
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    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:
    1. If LCase$(Left$(App.Path, 2)) = Left$(drvList.Drive, 2) Then
    2.             dirList.Path = Left$(App.Path, 2) & "\"
    3.         Else
    4.             dirList.Path = Left$(drvList.Drive, 2)
    5.         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
  •  



Click Here to Expand Forum to Full Width