473,396 Members | 1,875 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,396 software developers and data experts.

Get Folder

Hi,
Is there a way to use the OpenFileDialog to retrieve a directory?

I need to allow the user to set a directory and it may not have any files in
it.

Doug
Nov 21 '05 #1
8 1121
doug there is another object for this.

FolderBrowserDialog

HTH,

shane
"Doug Bell" <dug@bigpond> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Hi,
Is there a way to use the OpenFileDialog to retrieve a directory?

I need to allow the user to set a directory and it may not have any files in it.

Doug

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.745 / Virus Database: 497 - Release Date: 8/27/2004
Nov 21 '05 #2
"Doug Bell" <dug@bigpond> schrieb
Is there a way to use the OpenFileDialog to retrieve a directory?
Hi Doug,

if the directory is empty, no.
I need to allow the user to set a directory and it may not have any files
in
it.


Another possibility is to use the FolderBrowserDialog and to check whether
the selected directory contains files or not:

If FolderBrowserDialog1.ShowDialog = DialogResult.OK Then
Dim di As DirectoryInfo = New DirectoryInfo( _
FolderBrowserDialog1.SelectedPath)
If di.GetFiles.Length > 0 Then
MessageBox.Show("...")
End If
End If

Cheers

Arne Janning
Nov 21 '05 #3
* "Doug Bell" <dug@bigpond> scripsit:
Is there a way to use the OpenFileDialog to retrieve a directory?


..NET 1.1:

'FolderBrowserDialog' Class ('System.Windows.Forms.FolderBrowserDialog')
<URL:http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemWindowsFormsFolderBrowserDialogClassTop ic.asp>

Note that there is a bug in the .NET Framework 1.1 that causes a really bad
error when using a path longer than about 128 characters. This occurs on
Unicode systems only. Use the p/invoke solutions listed below instead.

..NET 1.0:

Folder Browser component for .NET
<URL:http://www.codeproject.com/cs/miscctrl/folderbrowser.asp>

HOW TO: Implement a Managed Component that Wraps the Browse For Folder
Common Dialog Box by Using Microsoft Visual Basic .NET
<URL:http://support.microsoft.com/?kbid=811004>

FolderBrowser.msi
<URL:http://www.gotdotnet.com/team/vb/FolderBrowser.exe>

How to pick a directory
<URL:http://groups.google.com/groups?selm=q0JKzDbmCHA.2144%40cpmsftngxa09>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #4
I was writing this already that this message would come, however to be sure
I waited (The word terrrible is disapeared, some reason)

:-)

Cor
Nov 21 '05 #5
The bug you mention, is that this one?
http://support.microsoft.com/?kbid=830920

If so, looks like it will get fixed in .NET 1.1 SP 1 (due in Sep)
http://msdn.microsoft.com/netframewo...tent11sp1.aspx

Greg

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:2p************@uni-berlin.de...
Note that there is a bug in the .NET Framework 1.1 that causes a really bad error when using a path longer than about 128 characters. This occurs on
Unicode systems only.

Nov 21 '05 #6
Greg,

Great post.

I see Herfrieds next post already

Note that there is a bug in the .NET Framework 1.1 without SP1 that causes a
really bad error when using a path longer than about 128 characters.

Description of the bug
http://support.microsoft.com/?kbid=830920

Fixes in.NET 1.1 SP 1
http://msdn.microsoft.com/netframewo...tent11sp1.aspx

:-)

Herfried feel free to copy this

:-)

Cor
Nov 21 '05 #7
* "Greg Burns" <greg_burns@DONT_SPAM_ME_hotmail.com> scripsit:
The bug you mention, is that this one?
http://support.microsoft.com/?kbid=830920

If so, looks like it will get fixed in .NET 1.1 SP 1 (due in Sep)
http://msdn.microsoft.com/netframewo...tent11sp1.aspx


Yes, that's the bug I was talking about. I'll update my FAQ. Thanks
for making me aware of that.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #8
Thanks,
The Class Module FolderBrowserDialog works fine.

"SStory" <Th*******@TAKEOUTTHISSPAMBUSTERsofthome.net> wrote in message
news:OV*************@TK2MSFTNGP12.phx.gbl...
doug there is another object for this.

FolderBrowserDialog

HTH,

shane
"Doug Bell" <dug@bigpond> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Hi,
Is there a way to use the OpenFileDialog to retrieve a directory?

I need to allow the user to set a directory and it may not have any
files in
it.

Doug

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.745 / Virus Database: 497 - Release Date: 8/27/2004

Nov 21 '05 #9

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

Similar topics

13
by: jenny | last post by:
Hi, I am trying to find a VB way that would create a folder on all existing drives - the folder name would be the same on each drive. ie c:\backup, d:\backup, etc. But the folders would only be...
7
by: Tom | last post by:
Can anyone give me any advice on how to secure a folder on a network server so that documents in the folder can only be opened through an Access database or by the database admin. I need to store...
0
by: John H. | last post by:
In effort to understand (Outlook) MAPI folder tree structure wrote simple linear code below to navigate tree. Successive "...Folders.GetNext()"'s return same folder at all levels of tree. What...
4
by: Dave Veeneman | last post by:
I'm puzzling over the best design for a Folder object. I have two basic domain objects; leat's call them an Apple and an Orange. The objects are maintained in separate hierarchies, and each...
8
by: vinesh | last post by:
I have sample Asp.Net Web Application project. Let me know how to keep the files related to this project (like the webform.aspx, WebForm1.aspx.vb, WebForm1.aspx.resx) in a separate folder within a...
9
by: Paul | last post by:
I'm trying to make get my app to delete all the files in a specified folder and all the files within the folders of the specified folder. e.g. Folder 1 contains three files (File1, File2, File3)...
2
by: tatemononai | last post by:
Ok, this is a very unique bug. I have only been able to find one other post related to this online, and everybody who responded misunderstood the problem. I am not trying to reference anything in...
17
by: rdemyan via AccessMonster.com | last post by:
With A2003, I'm having trouble accessing files in a folder on another computer where back-end files, update files, etc are located. Here's the scenario: 1) Computer #1 - A2003 2) Computer #2 -...
24
by: biganthony via AccessMonster.com | last post by:
Hi, I have the following code to select a folder and then delete it. I keep getting a Path/File error on the line that deletes the actual folder. The line before that line deletes the files in...
5
by: Noozer | last post by:
I'm looking for a "smart folder" program to run on my Windows XP machine. I'm not having any luck finding it and think the logic behind the program is pretty simple, but I'm not sure how I'd...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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
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...
0
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...
0
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...
0
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,...

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.