Skip to main content
Email Password   helpLost your password?

Screenshot - Article.gif

Introduction

The problem is this : programmers are not allowed to inherit the files dialog boxes in vb.net2005

and there are two kinds : open and save.

once ago, I made an encryption program that worked like a safe

for personal data ,in my program there were buttons named: import and export

and I thought it is ugly to use dialogs with buttons whose caption is (save ,open)

so I know some people will need to change buttons' captions in certain situations.

This project is good for those who want to design a customized file dialog box

It contains an implementation of three " tree view " file dialog boxes

first one uses microsoft files-folders tools .

second one is a simple dialog that will show a file description of any file you select.

the third one is a rich dialog with progress bar , movable menu , status bar and multiple view choices :
details ,list, larg icons ...

Background

basic knowledge of the language and tree-list view controls .

Using the code

import all code files of the dialog you like in your project and

Just handle the files in the code of "proceed" button instead of showing msgbox of them.

I will not explain everythings but only the headlines:

when you load the form ,the program will use Directory.GetLogicalDrives to take

all the drives in your computer ,and will add them in the tree view control , an image list is needed here to set

small icons for the list of drives

now we will need a procedure to get one level folders to handle the click on any node (after select event)

this procedure will take the name of the node ( drive or folder ) and will display the childs of this node

according to the names of the nested folders of that drive or folder and will display the files of it in the list view

control and two image lists are needed here because of the two views (larg icons,small icons) and you must bind them to the list control ,here are the main procedures :

//   this will generate one level of folders in the tree node


// itree is the mother node and path is logical path on hard disk that this node stands for.

 
// Sub printfilesfolders_here(ByVal path As String, ByRef itree As TreeNode) 

//Dim foldername As String 

//Dim filename As String 

//itree.Nodes.Clear() 

//On Error GoTo eee 

//For Each foldername In Directory.GetDirectories(path) ''take the name of folders in the folder or drive

// On Error GoTo eee 

// Dim jj = foldername.LastIndexOf("\") 

//Dim jj1 = foldername.Length - jj 

//Dim foldr = foldername.Substring((jj + 1), (jj1 - 1))'separate the name from the path

// itree.Nodes.Add(foldr, foldr) 'add only the name

//Next Exit Sub

// eee: 

//End Sub





//

//this will display files in the list view according to the path of the mother node


//Sub displayfiles(ByVal path As String)

//it uses for each  on Directory.GetFiles 

//to take the pathes of files and then it gets only the names and adds them

// in the list

//we use AddRange instead of add to gain the details view in the list



Points of Interest

If you shell the dialog after you add a usb flash disk or a new Network place they will not appear

so you may plan to add a refresh button.

History

last updated: 2-4-2007

You must Sign In to use this message board.
 
 
Per page   
 FirstPrevNext
GeneralNIcely Done Pin
apache1o
23:48 11 Jun '07  
QuestionI have a private question Pin
commandant_.
4:40 16 May '07  
Generalyou are extremely bright [modified] Pin
commandant_.
4:35 16 May '07  
GeneralWhat abt VS 2003 Pin
Pradeep Sen
21:11 14 May '07  
AnswerRe: What abt VS 2003 Pin
Alaa Jebran
10:35 15 May '07  
Generalrequest: Pin
Rola saad
22:58 8 May '07  
GeneralRe: request: Pin
Alaa Jebran
0:16 9 May '07  
GeneralRe: request: Pin
Alaa Jebran
0:17 9 May '07  
Generalgreat! Pin
Rola saad
22:50 8 May '07  
Generalwould you? Pin
Andromeda ..
22:11 8 May '07  
GeneralRe: would you? Pin
Alaa Jebran
0:15 9 May '07  


Last Updated 8 May 2007 | Advertise | Privacy | Terms of Use | Copyright © CodeProject, 1999-2009