1 Attachment(s)
[RESOLVED] Customize Common Dialog
I use common dialog.
an my data is in c:\Project\Data.
When I hit the Insert button, the common dialog come out at the specific path location
Code:
CommonDialog1.InitDir = "c:\Project\data"
but it able to browse the data at other path location by using drop down menu in look in combo box.How to disable the drop down menu in look in combo box?I just want it able to access the spesific location in folder directory.Have an Idea?
Re: Customize Common Dialog
If you don't want the user to change folders use the FileListBox control.
vb Code:
'Set path
File1.Path = "C:\"
'set file types to be displayed
File1.Pattern = "*.exe"
1 Attachment(s)
Re: Customize Common Dialog
Thank yo, I got some idea from your answer.
My data is in directory c:\Project\Data
Actually in Data folder, it have other directory.
So I choose to use DirListbox and FileListBox
All data are store in data folder.
The Question is, if I use DirListbox, I don't want the user access other directory outside the c:\Project\Data, The user are allow to access the directory inside the Data folder.However, if use DirListbox, the user still able to browser in C: directory. I just want the user able to browse and access the directory and folder inside this location c:\Project\Data.
Code:
Dir1.Path = "C:\Project\Data"
Re: Customize Common Dialog
Try this
Code:
Private Sub Form_Load()
Dir1.Path = "C:\Project\Data"
File1.Path = Dir1.Path
End Sub
They can click around all they want to, but if you don't put the code it to respond to the clicks they aren't going anywhere.
Re: Customize Common Dialog
Remove this
Code:
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Don't let them do that. Only use the code in the Form Load.
Re: Customize Common Dialog
Now, I cannot see the data in the filelistbox inside the data folder. For you information, I want the user also able to access all directory and its file as long as the the directory are inside the data folder
for example C:\Project\Data\Soil, C:\Project\Data\Map C:\Project\Data\Nutrient, C:\Project\Data\Ma\P
At the moment, I just able to see the data file in data folder but not able to see the data file inside the data folder directory example C:\Project\Data\Map
User are not allow to see and access all data file in its directory execept the the data store in the location C:\Project\Data and it directory, Folder name 'DATA' iin the path location C:\Project\Data act as a parent in this case.
Re: Customize Common Dialog
If you permit them to open one folder, then they are going to be able to open them all.
May I ask why you don't want them outside of this folder structure?
Re: Customize Common Dialog
because I want to make it easier to find the data at the spesific location and browse the data inside the data folder only.
If I remove it, I unable to see the file inside the C:\Project\Data\K for example.
Code:
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
At the moment, I am able to see the file in the C:\Project\Data only.
If I don't remove the code below, I can able to browse the file inside C:\Project\Data but also able to see the data file outside the folder structure.
Code:
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
I don't want them browse outside of this folder structure
here all the code
Code:
Private Sub Form_Load()
Dir1.Path = "C:\Project\Data"
File1.Path = Dir1.Path
End Sub
Re: Customize Common Dialog
As I said
Quote:
Originally Posted by Hack
If you permit them to open one folder, then they are going to be able to open them all.
As I asked
Quote:
Originally Posted by Hack
May I ask why you don't want them outside of this folder structure?
Re: Customize Common Dialog
Sorry if my english is not good enough to able you to answer my questions
Aswser question 1
Quote:
Originally Posted by Hack
If you permit them to open one folder, then they are going to be able to open them all.
If I permit the to open one folder in the form load
Dir1.Path = "C:\PROJECT\Data", I able to see the file of the Data folder in filelistbox. But If change the directory in the Dirlistbox for example C:\PROJECT\Data\K, the file of that folder is not change in filelistbox. It still remain.
Answer question for question 2
Quote:
because I want to make it easier to find the file at the spesific location and also able to browse the directory of the folder inside data folder only.
Re: Customize Common Dialog
Try this
Code:
Private Sub Dir1_Change()
If Dir1.Path = "c:\" Then
Dir1.Path = "C:\PROJECT\Data\"
Else
File1.Path = Dir1.Path
End If
End Sub
Re: Customize Common Dialog
Thank you so much your are a great man :) :) :) :) :wave:
Code:
Private Sub Dir1_Change()
If Dir1.Path = "C:\" Then
Dir1.Path = "C:\Test\Data\"
Else
File1.Path = Dir1.Path
End If
End Sub