iflash2
asked on
How to Display Open Directory Dialogue Box
Hi all,
Instead of of selecting a file, I'm trying to let the user select a directory in a dialogue box.
Thank you
Instead of of selecting a file, I'm trying to let the user select a directory in a dialogue box.
Thank you
ASKER
Hi VBtorment,
I think im using the older version of VB.NET (2002)... there is no FolderBrowserDialog box.. is there another way to do this?
I think im using the older version of VB.NET (2002)... there is no FolderBrowserDialog box.. is there another way to do this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Use OpenFileDialog control and add the following code.
Dim OpenDig As New OpenFileDialog()
OpenFileDialog1.Title = "Title of the Dialog Box"
OpenFileDialog1.DefaultExt = ".doc"
OpenFileDialog1.ShowDialog
End If
Dim OpenDig As New OpenFileDialog()
OpenFileDialog1.Title = "Title of the Dialog Box"
OpenFileDialog1.DefaultExt
OpenFileDialog1.ShowDialog
End If
koolnurd's answer looks about right, just thought id add what to do after your user has selected a file.
Once the user has selected a file, you can retrieve the path of the file/folder selected using OpenFileDialog1.FileName
Then you can instruct your app to do whatever you require using that path.
Jaz
Once the user has selected a file, you can retrieve the path of the file/folder selected using OpenFileDialog1.FileName
Then you can instruct your app to do whatever you require using that path.
Jaz
I dont agree with jazduck, Directory selection is a separate thing.
If you do not have a file in the directory in koolnurd method you cannt select that directory
If you do not have a file in the directory in koolnurd method you cannt select that directory
Your right armoghan, i misread the question slightly. OpenFileDialog would be correct to select a file, not a folder.
Accept Armoghan
Use the FolderBrowser object from the toolbar, then use this code:
FolderBrowserDialog1.Selec
FolderBrowserDialog1.ShowN
FolderBrowserDialog1.Descr
FolderBrowserDialog1.ShowD
If FolderBrowserDialog1.ShowD
TextBox2.Text = FolderBrowserDialog1.Selec
End If