Geekpedia Tutorials Home

Building a C# Chat Client and Server

Building a C# Chat Client and ServerA step by step tutorial teaching you how to create your own chat client and chat server easily in C#, for local networks or the Internet.

in C# Programming Tutorials

Getting Hard Drive Information

Getting Hard Drive InformationA C# tutorial showing you how to make use of WMI to extract information on disk drives, such as model, capacity, sectors and serial number.

in C# Programming Tutorials

UPS Shipping Calculator

UPS Shipping CalculatorThis tutorial will teach you how to calculate the shipping cost based on the weight, height, length and depth of the box, the distance and the UPS service type.

in PHP Programming Tutorials

Create Your Own Rich Text Editor

Create Your Own Rich Text EditorCreating a Rich Text Editor using JavaScript is easier to do than you might think, thanks to the support of modern browsers; this tutorial will walk you through it.

in JavaScript Programming Tutorials
Search
Tutorials
Programming Tutorials
IT Jobs
From CareerBuilder

How to get all logical drives on a system?

On Wednesday, July 14th 2004 at 12:00 AM
By Andrew Pociu (View Profile)
****-   (Rated 4 with 3 votes)
Advertisement
More C# Resources
By calling a static method from System.Environment called GetLogicalDrives(). This returns a string array that you can easily iterate.
Suppose you have a ListBox and a button:

private void btnPopulate_Click(object sender, System.EventArgs e)
{
   // Store in a string array
   string[] drives = Environment.GetLogicalDrives();
   // Loop into the string array
   foreach(string strDrive in drives)
   {
      // Add items (drives) to the list
      listBox1.Items.Add(strDrive.ToString());
   }
}
Digg Digg It!     Del.icio.us Del.icio.us     Reddit Reddit     StumbleUpon StumbleIt     Newsvine Newsvine     Furl Furl     BlinkList BlinkList

Rate Rate this Knowledge Base article
Comment Current Comments
by Arvind Kumar on Monday, November 21st 2005 at 05:27 PM

Good and very useful for me, Thank You

by shakeel on Wednesday, September 12th 2007 at 05:06 AM

Great stuff, <a href=\"http://www.simplytheticket.com\">Shakeel</A>

by on Saturday, October 20th 2007 at 05:43 PM

Thanks
saved me some time getting it to work myself.

by Kannan on Friday, December 14th 2007 at 11:38 AM

Very useful. Thanks.

by rabih ayoub on Wednesday, January 9th 2008 at 05:53 AM

how to get logical drive on the client side using asp.net

by venkat on Thursday, March 20th 2008 at 01:51 AM

hi rabih ayoub.
i want same u..
how to get the all drives of the client system.
if u got that send me..

by Srizzler on Wednesday, March 4th 2009 at 08:03 PM

Hi Guys:

Can anyone tell me how to get network folders/mapped drives thru C#. Environment.GetLogicalDrives will only get Machine's Local Drives.

Please help me out.

Thanks in Advance.
Srizzler.

by AyrA on Monday, June 8th 2009 at 01:02 AM

Iterate trough a String "abce....xyz" with .ToCharArray() in a foreach loop. Then simply try with the new System.IO.DriveInfo(letter) if the Drive exists
AyrA
http://ayra.ch

by Wasiqs on Friday, October 2nd 2009 at 10:31 AM

simpliest way: DriveInfo.GetDrives()

by gopal on Saturday, March 13th 2010 at 01:21 AM





it's very useful
Thanks dude

by Yanela Somdaka on Monday, August 30th 2010 at 07:24 AM

DriveInfo[] drives = DriveInfo.GetDrives();

foreach (DriveInfo strDrive in drives)
{}


Comment Comment on this Knowledge Base article
Name: Email:
Message:
Knowledge Base Related Knowledge Base Articles
There are no related KB articles.

Comment Related Source Code
There is no related code.

Comment Related Tutorials
There are no related tutorials.

Jobs C# Job Search
My skills include:

Enter a City:

Select a State:


Advanced Search >>
Sponsors
Discover Geekpedia

Other Resources