9. Design an application in VB which has a Drivelistbox, Dirlistbox, Filelistbox control. The form contains the following command buttons: i) All drives : Display all drives in computer (including network drives) ii) All subdirectories: Display all subfolders of the currently selected directory. iii) All files : Display a popup menu which contains the following options: a. All document files b. All bitmaps c. All files On selection of option,display the specified type.


Private Sub cmdAddDrives_Click()
lstResult.AddItem Drive1.List(I)
Next
End Sub

Private Sub cmdAllFiles_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
PopupMenu mnuFiles
End If
End Sub

Private Sub cmdAllSubDirectories_Click()
lstResult.Clear
For I = 0 To Dir1.ListCount – 1
lstResult.AddItem Dir1.List(I)
Next
End Sub

Private Sub cmdClear_Click()
lstResult.Clear
End Sub

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

Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub
Private Sub mnuAllFiles_Click()
File1.Pattern = “*.*”
For I = 0 To File1.ListCount – 1
lstResult.AddItem File1.List(I)
Next
End Sub

Private Sub mnuBitmaps_Click()
File1.Pattern = “*.bmp”
For I = 0 To File1.ListCount – 1
lstResult.AddItem File1.List(I)
Next
End Sub

Private Sub mnuText_Click()
File1.Pattern = “*.txt”
For I = 0 To File1.ListCount – 1
lstResult.AddItem File1.List(I)
Next
End Sub

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s