Results 1 to 6 of 6

Thread: [RESOLVED] dirlistbox problem

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    1,370

    Resolved [RESOLVED] dirlistbox problem

    I use dirlistbox, Filelistbox, Drivelistbox. I run my Visual Basic Project from C:\TEST1 and my data store In path location "c:\Test\Data" or " d: \Test\Data\".

    During the form load, dirlistbox show the the path "c:\Test\Data" , drivelistbox show c:\. When I change drivelistbox from C to D, the dirlistbox show d:\Test\Data\. It work fine to me.

    The problem come out, When I try change back to C drive using drivelistbox , the dirlistbox show the wrong part data location. I show me the part of my Visual Basic Project C:\TEST1. I want the dirlistbox show me the part of data location c:\Test\Data not the part of my visual basic project C:\TEST1

    Have any Idea?Below is the code

    When I try to change the drivelistbox, the dirlistbox
    Code:
    Private Sub Drive1_Change()
    Dir1.Path = Drive1.Drive
    End Sub
    
    Private Sub Form_Load()
    
    Dir1.Path = "c:\Test\Data"
    Drive1.Drive = "c:\"
    File1.Path = Dir1.Path
    File1.Pattern = "*.shp"
    End Sub
    
    Private Sub Dir1_Change()
    
    If Dir1.Path = "c:\" Then
       Dir1.Path = "c:\Test\Data\"
    ElseIf Dir1.Path = "d:\" Then
    Dir1.Path = "d:\Test\Data\"
    Else
     File1.Path = Dir1.Path
    End If
    Below is the part of my visual basic project not the part of data location
    Attached Images Attached Images  

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: dirlistbox problem

    Try
    Code:
    If Drive1.Drive = "c:" Then
       Dir1.Path = "c:\Test\Data\"
    End If

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    1,370

    Re: dirlistbox problem

    What event I should paste that code?I assume that,I almost solving my problem when i see that code.

    Code:
    If Drive1.Drive = "c:" Then
       Dir1.Path = "c:\Test\Data\"
    End If

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: dirlistbox problem

    You need to captue when the DRIVE has CHANGEd, so....where do you believe it should go?

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    1,370

    Re: dirlistbox problem

    I got it. At Drive1_Change event

    Thank you so much!!!!

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: [RESOLVED] dirlistbox problem

    No problem.

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