Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open file dialog.

Status
Not open for further replies.

Elsje

Programmer
Feb 20, 2004
44
BE
Hi,

I use a openfile dialog in my program.
When I open this I fill up the initialdirectory.
I would like to know if there is a possibilty to prevent the user from changing the directory. The need to choose a file in the directory that I have specified in the the property initialdirectory.

Thanks in advance.
 
I dont think this is possible, this is not the purpose of that dialog. I can see 2 ways:

1. When he selects a file, check if the file belongs to the initialdirectory. Not of course with the File.Exists(..) method but by string comparing the to FULL path of the fileopendialog.filename with the initialdirectory & filename. Only a few lines of code are needed.

2. Create you own dialog. A form with a listbox for example. Using the IO package methods, get the files [Dim di As New IO.DirectoryInfo(path)] and add them to the listbox, so he cant choose other than these files of you "initial directory
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top