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
Below is the part of my visual basic project not the part of data locationCode: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




Reply With Quote