473,797 Members | 3,204 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 15414
Unfortuanally nothing is included that I know of other than going back to
the SHBrowseForFold er() 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.Des ign" (system.design. dll).
2. You could try this...

Imports System.Windows. Forms.Design

Public Class OpenDirectoryDi alog
Inherits FolderNameEdito r

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.DialogRes ult
With fb
.Description = _Description
.StartLocation = FolderNameEdito r.FolderBrowser Folder.MyComput er
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 OpenDirectoryDi alog()
With d
If .ShowBrowser = DialogResult.OK Then
txtDirectory.Te xt = .Path
End If
End With

"Pablo" <pp******@monte video.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-----
Unfortuanall y nothing is included that I know of other than going back tothe SHBrowseForFold er() 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=OQieY08y CHA.2368%40TK2M SFTNGP12&rnum=6
1. You need to add a reference to "System.Des ign" (system.design. dll).2. You could try this...

Imports System.Windows. Forms.Design

Public Class OpenDirectoryDi alog
Inherits FolderNameEdito r

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.DialogRes ult With fb
.Description = _Description
.StartLocation = FolderNameEdito r.FolderBrowser Folder.MyComput er 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 OpenDirectoryDi alog()
With d
If .ShowBrowser = DialogResult.OK Then
txtDirectory.Te xt = .Path
End If
End With

"Pablo" <pp******@monte video.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
5687
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 reduced my form request to a simple text string entry, instead of my desired optional parameters. As i have been stuck with a single unfathomable glitch for over a year. Basically, if i enter queries such as ; "select * from table" "select * from...
3
3448
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
1941
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 opening the file... Code: function UTIL_ForceDownloadFile(strFileName, strFileSaveName) Response.Buffer = True Dim strFileSize Const adTypeBinary = 1
0
1130
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 to find a way to do this using the "FolderBrowser class" I' we also tried to go by the shell methods but haven't found anything yet. Might be that I haven't investigated the methods properly but I do need the help..
2
325
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 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?
1
4683
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 target="_blank". But what for button ? So, each time new popup window should be open. My code is as following :
1
2836
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 open in new tab/window button works for them. Is there some setting I am missing that allows this to feature to work correctly? I don't have any code purposely preventing pages from being opened in the same window...don't know why that happens.
17
4568
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 open in a new window -regardless- of what you have your options set to. So, before I go digging around in the registry, I want to hear what you all would suggest doing to fix it. All these new windows are driving me nutters. Oh, before I forget:...
0
2196
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 accept only one file @ a time. i need to select a folder. is that possible. if so how to do abt tat. if not wats the alternate option
0
9685
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9537
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10469
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10023
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7560
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4135
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3750
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2934
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.