473,396 Members | 2,081 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.

I need a BrowseForFolder in C#!

I'm attempting to find the class that I can use to get a "Browse For Folder" dialog similar to SHBrowseForFolder, in C#. I can't seem to find anything that comes close.

I'm developing a small, small application to create M3U Playlists from my hierarchical organization of digital audio. I have the application working but I want to give myself the ability to easily select both the starting folder (on my file server), and the output folder (a local folder on my various PCs and laptops around the house). An OpenFileDialog just won't do the trick. I need that BrowseForFolder dialog. . . . but haven't found it in the Framework

I know I could create a dialog with a TreeView and buttons that would approximate my needs, but why should I add an entire logical tree-and-node structure to a program that's got less than 300 lines of code? As everyone is saying these days, "why reinvent the wheel"

Thanks for any help you can give

Ryan T
Nov 15 '05 #1
9 9709
"Ryan Trevisol" <ry***********@bellsouth.net> wrote in message
news:55**********************************@microsof t.com
I'm attempting to find the class that I can use to get a "Browse For
Folder" dialog similar to SHBrowseForFolder, in C#. I can't seem to
find anything that comes close.


System.Windows.Forms.FolderBrowserDialog browse =
new System.Windows.Forms.FolderBrowserDialog();
browse.ShowNewFolderButton = false;
browse.Description="Please select a folder";
browse.RootFolder=System.Environment.SpecialFolder .DesktopDirectory;
browse.SelectedPath = "apps";
if (browse.ShowDialog()==System.Windows.Forms.DialogR esult.OK)
MessageBox.Show(browse.SelectedPath);
else
MessageBox.Show("Cancelled");
--
C# newbie... posts are probably inaccurate, inelegant or both

Nov 15 '05 #2
That's only in 1.1. If your in 1.0, upgrade to 1.1 or find some source on
the web.

http://support.microsoft.com/?kbid=306285
-Eric
Nov 15 '05 #3
Hi,

One remark here,
this class is only available in version 1.1 of the framework.

Greetings,

Bram

"Bill Styles" <no*****@nowhere.com> wrote in message
news:ek**************@TK2MSFTNGP11.phx.gbl...
"Ryan Trevisol" <ry***********@bellsouth.net> wrote in message
news:55**********************************@microsof t.com
I'm attempting to find the class that I can use to get a "Browse For
Folder" dialog similar to SHBrowseForFolder, in C#. I can't seem to
find anything that comes close.


System.Windows.Forms.FolderBrowserDialog browse =
new System.Windows.Forms.FolderBrowserDialog();
browse.ShowNewFolderButton = false;
browse.Description="Please select a folder";
browse.RootFolder=System.Environment.SpecialFolder .DesktopDirectory;
browse.SelectedPath = "apps";
if (browse.ShowDialog()==System.Windows.Forms.DialogR esult.OK)
MessageBox.Show(browse.SelectedPath);
else
MessageBox.Show("Cancelled");
--
C# newbie... posts are probably inaccurate, inelegant or both

Nov 15 '05 #4
That makes sense. I may be working under 1.0 . . . My copy of .NET was provided by my school (fau). I'll have to check. But since that didn't show up under the Forms namespace (I read each entry), I can assume I have the old version.

If I have that version of .NET Professional (1.0), which is under license from my school, can I upgrade it? (read: free?)

Thanks for that help.
Nov 15 '05 #5
Sorry for being such a newbie . . .

I think if I just understood the .NET website correctly, that I only need to install the 1.1 SDK in order to have access to the new classes in Visual Studio? Is that the case?

Sorry for being such a pest. I've been programming in .NET for all of 2 weeks.
Nov 15 '05 #6
In article <B6**********************************@microsoft.co m>,
an*******@discussions.microsoft.com says...
I think if I just understood the .NET website correctly, that I only need to install the 1.1 SDK in order to have access to the new classes in Visual Studio? Is that the case?


Installing the 1.1 SDK will only give you the compilers. VS.NET 2002
only works with the 1.0 framework, so you'd have to stop using VS.NET
(or go to VS.NET 2003 and you can then target both 1.0 and 1.1).

If you need to interop with the SHBrowseForFolder in 1.0 see:

http://weblogs.asp.net/psteele/articles/7536.aspx

It's VB.NET, but could easily by ported to C# (or compiled in VB.NET as
a DLL).

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Nov 15 '05 #7
Well if that's the case I can't move up to 2003 because I can't afford it, but I can use the handy-dandy, 1.1-Compatible SharpDevelop (www.icsharpcode.net) to compile it (I just tried on my laptop, which is too slow for VS.NET but runs SharpDevelop). I haven't run into any other limitations so far so I'll keep plugging along with VS.NET2002. . .

Thanks for the help.
Nov 15 '05 #8
In article <50**********************************@microsoft.co m>, Ryan Trevisol wrote:
Well if that's the case I can't move up to 2003 because I can't afford it, but I can use the handy-dandy, 1.1-Compatible SharpDevelop (www.icsharpcode.net) to compile it (I just tried on my laptop, which is too slow for VS.NET but runs SharpDevelop). I haven't run into any other limitations so far so I'll keep plugging along with VS.NET2002. . . .

Thanks for the help.


Didn't the uprgrade to 2003 cost $29? Not sure if that applies any
more.

--
Tom Shelton [MVP]
OS Name: Microsoft Windows XP Professional
OS Version: 5.1.2600 Service Pack 1 Build 2600
System Up Time: 9 Days, 1 Hours, 52 Minutes, 46 Seconds
Nov 15 '05 #9
I've seen this 'set-up' mentioned before, but does anyone have the steps
necessary to get VS 2002 to use (IDE and compile) against the 1.1 Framework?
I thought I saw mention of 'inconsistencies' and 'undependable' operation.

Chuck

"JPRoot" <an*******@discussions.microsoft.com> wrote in message
news:C2**********************************@microsof t.com...
We are using VS.NET 2002 and 1.1 together and it works just fine!

Just have to play with the references so that it refers 1.1 DLLs and not 1.0.
JPRoot

Nov 15 '05 #10

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

Similar topics

0
by: Sofia | last post by:
My name is Sofia and I have for many years been running a personals site, together with my partner, on a non-profit basis. The site is currently not running due to us emigrating, but during its...
6
by: Robert Maas, see http://tinyurl.com/uh3t | last post by:
System login message says PHP is available, so I tried this: http://www.rawbw.com/~rem/HelloPlus/h.php It doesn't work at all. Browser just shows the source. What am I doing wrong?
0
by: Gregory Nans | last post by:
hello, i need some help to 'tree-ify' a string... for example i have strings such as : s = """A(here 's , B(A ) silly test) C(to show D(what kind) of stuff i need))""" and i need to...
7
by: Mike Kamermans | last post by:
I hope someone can help me, because what I'm going through at the moment trying to edit XML documents is enough to make me want to never edit XML again. I'm looking for an XML editor that has a...
8
by: JustSomeGuy | last post by:
I need to write an new class derived from the list class. This class stores data in the list to the disk if an object that is added to the list is over 1K in size. What methods of the std stl...
3
by: Bob.Henkel | last post by:
I write this to tell you why we won't use postgresql even though we wish we could at a large company. Don't get me wrong I love postgresql in many ways and for many reasons , but fact is fact. If...
0
by: Sankar | last post by:
Hi all, I need to popup a folder dialog box on an aspx web page. The functionality needed is to select a folder name and assign it to one of the form variables in the web page. I used activex...
2
by: Michael R. Pierotti | last post by:
Dim reg As New Regex("^\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}$") Dim m As Match = reg.Match(txtIPAddress.Text) If m.Success Then 'No need to do anything here Else MessageBox.Show("You need to enter a...
0
by: U S Contractors Offering Service A Non-profit | last post by:
Brilliant technology helping those most in need Inbox Reply U S Contractors Offering Service A Non-profit show details 10:37 pm (1 hour ago) Brilliant technology helping those most in need ...
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: 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
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...
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,...
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
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.