Log inUsernamePassword
Log me on automatically each visit    
Register
Register
Log in to check your private messages
Log in to check your private messages
Visual Basic Forum for Visual Basic Programmers VB Forum Index » Registry & File Input / Output

Post new topic   Reply to topic
Drivelistbox & Filelistbox
View previous topic :: View next topic  
Author Message
D-Vine
Newbie


Joined: 30 May 2005
Posts: 4

PostPosted: Jun 23rd, 2005 01:03 PM    Post subject: Drivelistbox & Filelistbox Reply with quote

Ok
here's a question
how do i link a drivelistbox to a dirlistbox, like when you select your drive in the drivelistbox you get the folders from that drive in the dirlistbox
and how do i select the path of a single file in the filelistbox?
in the dirlistbox you can select a folder with .path, but how do you do it with a filelistbox?
Back to top
View user's profile Send private message
DoobieKeebler
Moderator


Joined: 17 Jun 2005
Posts: 254
Location: 181°15'2.003"W, 93°5'16.956"N

PostPosted: Jun 23rd, 2005 02:28 PM    Post subject: Re: Drivelistbox & Filelistbox Reply with quote

D-Vine wrote:
Ok
here's a question
how do i link a drivelistbox to a dirlistbox, like when you select your drive in the drivelistbox you get the folders from that drive in the dirlistbox

Dir1.Path = Drive1.Drive
Your dirlistbox is now looking at the root of the drive selected in the drivelistbox. (E.g. if the user selected the C: drive, then Dir1.Path = C:\

Quote:
and how do i select the path of a single file in the filelistbox?
in the dirlistbox you can select a folder with .path, but how do you do it with a filelistbox?

I'm not quite sure what you're asking for, but File1.Path is the directory that the filelistbox is "looking in".

Here's some quick code that may help you put this all together (which is what I think you're getting at.
Code:
Private Sub Drive1_Change()
    Dir1.Path = Drive1.Drive
End Sub

Private Sub Dir1_Change()
    File1.Path = Dir1.Path
End Sub

Private Sub File1_Click()
    Dim SelectedFile As string

    SelectedFile = File1.Path
    If Right(SelectedFile, 1) <> "\" Then
        SelectedFile = SelectedFile & "\"
    End If
    SelectedFile = SelectedFile & File1.FileName

    MsgBox "The file you chose is:" & vbCrLf & SelectedFile
End Sub


Create a new project, drop in the three controls, add the code, and run the program. 'Tis truly as simple as that.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Visual Basic Forum for Visual Basic Programmers VB Forum Index » Registry & File Input / Output All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Visual Basic Forum runs phpBB | Forum Template © iOptional
VB Resources | SSL | Visual Basic