473,785 Members | 2,333 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 15413
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
5686
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
3447
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
1940
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
4681
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
2835
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
4567
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
2187
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
9647
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
10162
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10101
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8988
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7509
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
5396
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5528
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4063
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
3
2893
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.