473,386 Members | 1,609 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Open the "select folder window" in vb.net

Friends!
I need to show the dialog "select folder" and get the
path selected, using vb.net. The OpenFileDialog control
is useless as I want to select a folder and not a file.
In vb6 I achieved this by an OCX called DPDLG, but
in .net i do not find the solution neither this ocx works
in .net.

Any idea? sample code?

Thanks a lot
Pablo
Jul 19 '05 #1
2 15353
Unfortuanally nothing is included that I know of other than going back to
the SHBrowseForFolder() API. Look that up on google and it should be pretty
strait forward on how to use. Only other solution is to write one from the
ground up.

Oh check this too:
This is not my work but was listed on a google search.
http://groups.google.com/groups?hl=e...FTNGP12&rnum=6

1. You need to add a reference to "System.Design" (system.design.dll).
2. You could try this...

Imports System.Windows.Forms.Design

Public Class OpenDirectoryDialog
Inherits FolderNameEditor

Dim _Description As String = "Please select a directory below:"
Dim _Path As String = String.Empty
Dim fb As New FolderBrowser()

Public Property Description() As String
Get
Return _Description
End Get
Set(ByVal Value As String)
_Description = Value
End Set
End Property
Public ReadOnly Property Path() As String
Get
Return _Path
End Get
End Property

Public Function ShowBrowser() As System.Windows.Forms.DialogResult
With fb
.Description = _Description
.StartLocation = FolderNameEditor.FolderBrowserFolder.MyComputer
Dim result As DialogResult = .ShowDialog
If result = DialogResult.OK Then
_Path = .DirectoryPath
Else
_Path = String.Empty
End If
Return result
End With
End Function
End Class
'Usage:
Dim d As New OpenDirectoryDialog()
With d
If .ShowBrowser = DialogResult.OK Then
txtDirectory.Text = .Path
End If
End With

"Pablo" <pp******@montevideo.com.uy> wrote in message
news:0b****************************@phx.gbl...
Friends!
I need to show the dialog "select folder" and get the
path selected, using vb.net. The OpenFileDialog control
is useless as I want to select a folder and not a file.
In vb6 I achieved this by an OCX called DPDLG, but
in .net i do not find the solution neither this ocx works
in .net.

Any idea? sample code?

Thanks a lot
Pablo

Jul 19 '05 #2
Bryan,

thanks a lot for your help. It's very useful. I'll try it.

Pablo
Montevideo, Uruguay
-----Original Message-----
Unfortuanally nothing is included that I know of other than going back tothe SHBrowseForFolder() API. Look that up on google and it should be prettystrait forward on how to use. Only other solution is to write one from theground up.

Oh check this too:
This is not my work but was listed on a google search.
http://groups.google.com/groups?hl=en&lr=&ie=UTF- 8&oe=UTF-8&selm=OQieY08yCHA.2368%40TK2MSFTNGP12&rnum=6
1. You need to add a reference to "System.Design" (system.design.dll).2. You could try this...

Imports System.Windows.Forms.Design

Public Class OpenDirectoryDialog
Inherits FolderNameEditor

Dim _Description As String = "Please select a directory below:" Dim _Path As String = String.Empty
Dim fb As New FolderBrowser()

Public Property Description() As String
Get
Return _Description
End Get
Set(ByVal Value As String)
_Description = Value
End Set
End Property
Public ReadOnly Property Path() As String
Get
Return _Path
End Get
End Property

Public Function ShowBrowser() As System.Windows.Forms.DialogResult With fb
.Description = _Description
.StartLocation = FolderNameEditor.FolderBrowserFolder.MyComputer Dim result As DialogResult = .ShowDialog
If result = DialogResult.OK Then
_Path = .DirectoryPath
Else
_Path = String.Empty
End If
Return result
End With
End Function
End Class
'Usage:
Dim d As New OpenDirectoryDialog()
With d
If .ShowBrowser = DialogResult.OK Then
txtDirectory.Text = .Path
End If
End With

"Pablo" <pp******@montevideo.com.uy> wrote in message
news:0b****************************@phx.gbl...
Friends!
I need to show the dialog "select folder" and get the
path selected, using vb.net. The OpenFileDialog control
is useless as I want to select a folder and not a file.
In vb6 I achieved this by an OCX called DPDLG, but
in .net i do not find the solution neither this ocx works in .net.

Any idea? sample code?

Thanks a lot
Pablo

.

Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
by: ian justice | last post by:
Before i post actual code, as i need a speedyish reply. Can i first ask if anyone knows off the top of their head, if there is a likely obvious cause to the following problem. For the moment i've...
3
by: Shiperton Henethe | last post by:
Hi Can anyone tell me how to open up a new normal, full-sized browser window from a small popup window? I'm using something like this. <script language="javascript"> <!--
0
by: Michael | last post by:
I have a problem forcing files to download. If I select Save the document is saved with no problems. If I select "Open" the document is empty or I get a "File not found" error from the application...
0
by: Nicklas | last post by:
Hi I need to open a folder window with a path decided by me. Eg. "C:\strangeFolder\myown". I.e. NOT a predefined folder defined by FolderId (e.g. MyDocuments, Printers etc.) I haven't managed...
2
by: Pablo | last post by:
Friends! I need to show the dialog "select folder" and get the path selected, using vb.net. The OpenFileDialog control is useless as I want to select a folder and not a file. In vb6 I achieved...
1
by: ranabhavin2 | last post by:
Hi, on button click I want to open new window each time. Currently when I m click on button second time then my new window is replaced with my original window. We can do it in hyperlink by ...
1
by: R Reyes | last post by:
Hi, For some reason, the website I made does not open pages in a new page whenever I right-click "Open in New Tab" or "Open in New Window". But, as soon as I navigate to any other website, the...
17
by: haldie | last post by:
Well, a long time ago, some bright person got a hold of my computer and decided to "improve" it. Apparently they fouled up the default "open" option on the folder "file type," causing a folder to...
0
by: pradheepayyanar | last post by:
hey i have an requirement which should select a folder in the web browser. i have an <input> element with <input type="file" name="file" accept="text/plain"> normally the type=file will...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.